The New-PSDrive cmdlet is used to create logical drives on a computer, including mapping drives to shared network folders.
How to Map a Network Drive with New-PSDrive?
You can map a shared network folder by its UNC path as a network drive by using the following command:
New-PSDrive -Name G -PSProvider FileSystem -Root '\\192.168.158.147\docs' -Persist

- Name โ a drive letter (most often), path or other identifier that will be assigned to the created logical drive.
- PSProvider โ the FileSystem provider is used to access network drives that are mapped via the SMB/CIFS protocol. Other providers are described below.
- Root โ the path to the resource to be mounted. It can be a UNC path to a shared folder (\\server1\share), a local directory (C:\ProgramData), or another resource.
- Persist โ reconnect the network drive automatically after a computer reboot or loss of connection. If this parameter is not specified, the temporary drive mapping mode will be used instead.
Note. The -Persist parameter can only be used when the -Name value is a single drive letter (for example, G, M, or Z). Keep in mind that custom PSDrive names (such as RegSoftware, stunnel, or myADCatalog) cannot be created as persistent Windows drives.
A network drive connected in this way will be accessible to users from both their shell and the File Explorer GUI.

Note. When you use -Persist inside a PowerShell script, the mapped drive may not remain available after the script finishes unless the drive is created in the Global scope. To make the mapping persist reliably, you should run the script by using dot-sourcing or specify -Scope Global when creating the PSDrive. Here is an example:
New-PSDrive `
-Name G `
-PSProvider FileSystem `
-Root "\\server\share" `
-Persist `
-Scope Global
Note. In order to make the network drive available to the user in File Explorer, the New-PSDrive command must be run in an unprivileged PowerShell session. Mounting a network drive using the specified command in the PowerShell console, which is run as an administrator, will make the drive accessible only in elevated apps.
Using different account credentials to access the shared folder
The network drive is mapped by default under the current user’s credentials. You can use different account credentials to access the shared folder.
$cred = Get-Credential -Credential reslab\abrion
New-PSDrive -Credential $cred `
-Name M `
-PSProvider FileSystem `
-Root '\\192.168.158.147\docs' `
-Persist
Troubleshooting when mapping a drive
If you encounter errors when mapping a drive, check that the UNC path to the shared network folder is correct and that your account has the appropriate permissions. Use File Explorer to see if the specified UNC path is accessible.
New-PSDrive : The network resource type is not correct
The specified network resource or device is no longer available

List mapped network drives:
Get-PSDrive

Show the user account that was used to map the shared folder.
(Get-PSDrive -Name 'M').Credential

Remove a mapped network drive:
Remove-PSDrive M
Note. To force a network drive to disconnect, add the -Force option.
Using New-PSDrive cmdlet to map network drive
The New-PSDrive cmdlet is most often used as an alternative to the net use command to map network drives. In addition to accessing the file system (local or network shares), the New-PSDrive cmdlet can also create virtual drives to simplify navigation and management of various storage providers. List the registered PSProviders that enable interaction with various types of resources through PSDrives:
Get-PSProvider
- Registry โ access to Windows registry
- Alias โ accessing PowerShell command aliases
- Environment โ access to environment variables
- FileSystem
- Function โ accessing PowerShell functions
- Variable โ PowerShell variables
- Certificate โ it provides access to user and computer certificate stores
- WSMan โ WS-Management settings

Note. In enterprise environments, network drive mappings are typically deployed centrally by using Group Policy Preferences (GPO), Microsoft Intune, or logon scripts. The New-PSDrive cmdlet is primarily useful for automation scripts, administrative tasks, and temporary drive mappings.
Other examples of using New-PSDrive
Create a PSDrive for a registry hive:
New-PSDrive -Name RegSoftware -PSProvider Registry -Root HKLM:\Software\

Mount a local folder as a separate drive:
New-PSDrive -Name stunnel -PSProvider FileSystem -Root "C:\Program Files (x86)\stunnel\bin"

Note. The ActiveDirectory PSProvider requires the AD PowerShell module, which is included with the RSAT (Remote Server Administration Tools) on Windows client computers/AD DS management tools on Windows Server.
Mounting the AD directory:
Import-Module activedirectory New-PSDrive -Name myADCatalog -PSProvider ActiveDirectory -Root "AD:\ OU=Users,OU=HQ,DC=reslab,DC=local" cd myADCatalog: dir

Wrapping Up
New-PSDrive provides you with a flexible way to create temporary and persistent drive mappings for file shares and other PowerShell providers. While enterprise environments typically deploy mapped drives through Group Policy/Intune, this cmdlet remains an excellent tool for automation, scripting, and admin tasks.
For enterprise drive deployment, you should continue using Group Policy Preferences/Microsoft Intune. We recommend using New-PSDrive primarily in PowerShell automation, deployment scripts, and admin troubleshooting.
What is the New-PSDrive cmdlet used for?
New-PSDrive creates PowerShell drives that provide access to various data stores. It’s commonly used to map network drives to SMB file shares, but it can also create drives for the Windows Registry, certificate stores, Active Directory, environment variables, and other PowerShell providers.
How do I map a network drive with PowerShell?
Use the New-PSDrive cmdlet with the FileSystem provider and specify the UNC path of the shared folder. Add the -Persist parameter if you want the drive to appear in File Explorer and reconnect automatically after sign-in.
How can I map a network drive using different credentials?
Create a credential object with Get-Credential and pass it to the -Credential parameter. This allows you to connect to a shared folder using an account different from the currently signed-in user.
Why doesn’t my mapped drive appear in File Explorer?
This usually happens when the drive was created:
- In an elevated (Run as Administrator) PowerShell session.
- Without the -Persist parameter.
- Inside a script without using -Scope Global or dot-sourcing.
For user-accessible mappings, run PowerShell as a standard user and create the drive in the global scope when appropriate.
How can I view or remove mapped drives?
You can:
- List all PowerShell drives with Get-PSDrive.
- View the credentials used for a mapped drive through its properties.
- Remove a drive with Remove-PSDrive, using -Force if the connection must be disconnected immediately.
