Tag Archives: powershell

Powershell comparison: $null on the left

When I write powershell scripts, I always use below method to check whether variable is null or not.

When I use VScode, VScode suggested me to put $null to left. Why?

Check below example:

So, the right way to compare is always put $null on the left side.

copy permissions from one folder to another folder (Windows)

There are several ways to do this:

The easiest way is to use powershell command:

You can also use iCACLS to backup the permission to a file and restore it.

Note: icacls doesn’t support restore drive root permission