Map Drive From Command Line [better] 〈Top 10 FRESH〉
By default, a drive mapped via net use lasts only for the current user session. Log off, and it’s gone. To make a mapping persistent across reboots, add the /persistent:yes flag:
You can also use additional options with the net use command: map drive from command line
By default, drives mapped via CMD disappear when you log out. To ensure the drive reconnects automatically every time you log in, add the /persistent:yes switch: net use Z: \\ServerName\ShareName /persistent:yes Deleting a Mapped Drive By default, a drive mapped via net use
Mastering net use and New-PSDrive turns drive mapping from a point-and-click chore into a scriptable, repeatable, and automatable operation. Whether you are deploying 200 workstations, maintaining a headless server, or simply tired of typing passwords into a dialog box, the command line offers speed, control, and depth that the GUI never will. To ensure the drive reconnects automatically every time
Remove-PSDrive -Name Z