How to rename mapped shares remotely?
Today, I came across a task of renaming all of our users personal folders to another server, and we have 1000 users. This will be a pain in the butt if I have to go to every station to manually remap the new share for them.
To avoid going to every station, I have searched online and luckily I found a script that does this. I did some modification and it is worked perfectly. I then added to the Logon script section in Group Policy.
Here are the code I found on the web:
@echo off
set OldName=OldServer
set NewName=NewServer
net use | find /i “\\%OldName%”
for /F “tokens=1-5″ %%a in (‘net use ^| find /i “\\%OldName%”‘) do call :Sub %%a %%b %%c %%d %%e
goto :eof
set ShareName=”%3″
call set ShareName=%%ShareName:%OldName%=%NewName%%%
net use %2 /d
net use %2 %ShareName% /persistent:yes