When updating or replacing a home PC I use Windows Deployment Services (WDS) to reinstall Windows. It means I only have to maintain a single up-to-date source for all the little free apps I use (Firefox, 7zip, Kodi, etc) and makes a new setup much more painless. One of the few bugs that has irritated me for ages is the network drive map that I create has always had to be renamed manually.
I think the problem stems from the need for admin rights when renaming a drive. Whilst I can run the rename command as an administrator this seems to fail as the share isn’t present for the admin account, only for the user account. What I would need to do is run the command as the user and then elevate it. I don’t know of any scripting way to do this, so the normal rename command seems a dead loss.
The good news is that there is a way to do the rename via the registry, and registry changes can easily be made from the command line. To map and rename a share requires just 2 commands
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\##server-name#share-name /v _LabelFromReg /t REG_SZ /f /d “Name to use for share”
net use y: \\server-name\share-name /user:server-name\username password /persistent:yes
This can be put in a simple batch file and duplicate for each share you want to map. Viola — no more ugly names for network shares
“Hi James I realise it has been a long while, but I just checked this on windows 11 (build 23H2)…”