net use Z: /delete To delete all mapped drives at once (common in logoff scripts):
| Task | Command | |------|---------| | Map persistent drive | net use Z: \\server\share /persistent:yes | | Map with specific credentials | net use Z: \\server\share /user:DOMAIN\user * | | Delete mapping | net use Z: /delete | | Delete all mappings | net use * /delete | | PowerShell persistent drive | New-PSDrive -Name Z -PSProvider FileSystem -Root \\server\share -Persist | | View all connections | net use |
net use Z: \\server\share /persistent:yes Once you set /persistent:yes , subsequent net use commands (without specifying persistence) will also be persistent until you turn it off with /persistent:no . Sometimes you need to access a share with alternate credentials while logged into Windows with your standard account. The /savecred flag stores the password for future sessions:
net use * /delete While net use works everywhere, PowerShell offers richer control and better integration with modern authentication, including Azure AD and certificate-based logins. New-PSDrive for Persistent Mappings PowerShell’s drive cmdlets are primarily for creating session-scoped PSDrives (like HKLM:\ for the registry). However, with the -Persist flag, you can create a standard Windows mapped drive:
This feature dives deep into the art and science of mapping drives from the command line, from basic syntax to advanced scripting techniques. The net use command is a relic of the MS-DOS and OS/2 era, yet it remains one of the most reliable networking tools in modern Windows. It connects, disconnects, and displays information about shared resources. Basic Mapping Syntax The simplest form is almost poetic in its brevity:
net use Z: /delete To delete all mapped drives at once (common in logoff scripts):
| Task | Command | |------|---------| | Map persistent drive | net use Z: \\server\share /persistent:yes | | Map with specific credentials | net use Z: \\server\share /user:DOMAIN\user * | | Delete mapping | net use Z: /delete | | Delete all mappings | net use * /delete | | PowerShell persistent drive | New-PSDrive -Name Z -PSProvider FileSystem -Root \\server\share -Persist | | View all connections | net use | map drive from command line
net use Z: \\server\share /persistent:yes Once you set /persistent:yes , subsequent net use commands (without specifying persistence) will also be persistent until you turn it off with /persistent:no . Sometimes you need to access a share with alternate credentials while logged into Windows with your standard account. The /savecred flag stores the password for future sessions: net use Z: /delete To delete all mapped
net use * /delete While net use works everywhere, PowerShell offers richer control and better integration with modern authentication, including Azure AD and certificate-based logins. New-PSDrive for Persistent Mappings PowerShell’s drive cmdlets are primarily for creating session-scoped PSDrives (like HKLM:\ for the registry). However, with the -Persist flag, you can create a standard Windows mapped drive: with the -Persist flag
This feature dives deep into the art and science of mapping drives from the command line, from basic syntax to advanced scripting techniques. The net use command is a relic of the MS-DOS and OS/2 era, yet it remains one of the most reliable networking tools in modern Windows. It connects, disconnects, and displays information about shared resources. Basic Mapping Syntax The simplest form is almost poetic in its brevity: