New-PSDrive -Name "Z" -PSProvider FileSystem -Root "\\Server01\Projects" -Persist The -Persist switch is equivalent to /persistent:yes in CMD. PowerShell also allows mapping using different credentials:
echo All drives mapped successfully. pause cmd command to map network drive
net use Z: /delete Always confirm by running net use again to ensure it is gone. To wipe all current network connections in one command (useful for login scripts to start fresh): cmd command to map network drive