New-PSDrive

Install a new PowerShell drive (ndr, mount).

Syntax
      New-PSDrive [-name] string -pSProvider string
         [-root] string [-description string] [-scope string]
            [-credential PSCredential] [-whatIf] [-confirm] [CommonParameters]

Key
   -name 
       The PowerShell drive name to be added.

   -pSProvider 
       The name of the provider, if omitted you will be prompted.
       e.g. FileSystem, Registry or Certificate. 

   -root string
       The provider internal root or path for the drive being added.

   -description string
       A short description of the drive.

   -scope 
       An index used to identify the scope where the drive will be installed.

   -credential PSCredential
       Use a credential to validate access to the file. Credential represents
       a user-name, such as "User01" or "Domain01\User01", or a PSCredential
       object, such as the one retrieved by using the Get-Credential cmdlet.
       If you type a user name, you will be prompted for a password.

   -whatIf
       Describe what would happen if you executed the command without
       actually executing the command.

   -confirm
       Prompt for confirmation before executing the command.
		
   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.

Examples

Install a drive called 'SS64' using the file system provider. The drive will be rooted at "C:\MyDocs":

PS C:\>new-Psdrive -name SS64 -psProvider FileSystem -root C:\MyDocs
DIR SS64:


Install a drive called 'S:' using the file system provider. The drive will be rooted at "C:\MyDocs":

PS C:\>new-Psdrive -name S -PsProvider FileSystem -root C:\MyDocs
S:
PS S:\>DIR S:

The parameters are positional, so
PS C:\>New-PSDrive -name M -psprovider FileSystem -root \\Server\Share

is the same as
PS C:\>New-PSDrive M FileSystem \\Server\Share

"If the automobile had followed the same development cycle as the computer, a Rolls-Royce would today cost $100, get a million miles per gallon, and explode once a year, killing everyone inside" - Robert X. Cringely, InfoWorld

Related:

Get-PSDrive - Get drive information (DriveInfo)
Remove-PSDrive - Remove a provider/drive from its location
Get-Command - Retrieve basic information about a command
Get-Member - Enumerate the properties of an object
Equivalent bash command: mount - Mount a file system



Back to the Top

© Copyright SS64.com 1999-2010
Some rights reserved