Map Drive From Command Line Jun 2026

$cred = Get-Credential New-PSDrive -Name "Z" -PSProvider FileSystem -Root "\\server\share" -Credential $cred -Persist

Note: This only removes the mapping from the current session if not persistent. For persistent drives, net use Z: /delete is still the most reliable method. map drive from command line

For decades, the average Windows user has mapped network drives the same way: open File Explorer, right-click "This PC," select "Map network drive," pick a letter, type a path, and click "Finish." It’s visual, intuitive, and serviceable for the occasional connection. right-click "This PC