Virtual Drives With UNC-Paths

by Jul 1, 2009

With New-PSDrive, you can create new virtual PowerShell drives to locations you often visit. New-PSDrive needs three pieces of information: the name of the new drive, the PowerShell provider you'd like to use and finally the root of your new drive.

For example, to create a drive that points to your user profile, use this line:

New-PSDrive home FileSystem $home

You can now navigate to your profile simply by using the new home: drive:

Dir home:

Or, you can add a new drive pointing to HKEY_CLASSES_ROOT like this:


A little-known fact is that you can also use UNC Paths as root. To map a UNC path to a virtual drive, use this approach:

New-PSDrive NetDrive FileSystem \$
Dir NetDrive: