Need Batch file or VBScript to Automatically Change User Defined Sharenames from One File Server to Another File Server

Would like a batch file or VBScript to automatically change user defined sharenames from one file server to another file server as each user logs into the domain. I'm migrating file shares from a source server to a destination server. I have already recreated all the source sharenames on the destination file server and copied the data from the source file server to the destination file server. Now I need a batch file or VBScript to automatically change user defined sharenames, defined on each computer in each user's HKEY_CURRENT_USER\Network registry hive, from \\sourceservername\fileshare1 to \\destinationservername\fileshare1.
The batch file or VBScript needs to change all references from \\sourceservername to \\destinationservername for all HKEY_CURRENT_USER\Network registry hive keys for each user as they log into the domain. I would like to add the batch file or VBScript to the global logon script already in place as each user logs into the domain.
If there is a better way to accomplish this, please indicate and explain how.
Thanks in advance.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITEnd-user supportCommented:
So I guess your users could map at will?
Here's a plain batch script. Note that it's currently in test mode and will only display the "net use" commands it would normally run. Remove the uppercase ECHOs in lines 33 and 34 to run it for real.
For testing, it will currently write its output to the console. When you run it as a logon script, you can set the LogFile variable to a file path where the user has write access (like %Temp%\logon.log - no double quotes required) instead of the current CON:. The script can handle an FQDN as well (if the domain name remains the same, which seems to be the case), you only need to enter the server's host name
@echo off
setlocal enabledelayedexpansion
set OldServer=sourceservername
set NewServer=destinationservername
set LogFile=CON:
>>"%LogFile%" echo Processing mapped drives:
for /f "tokens=3 delims=\" %%a in ('reg.exe query "%Key%" ^| find.exe /i "%Key%"') do (
	call :Process %%a
>>"%LogFile%" echo ... done.
goto :eof

:Process <Drive letter>
set Drive=%~1
for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do set Drive=!Drive:%%a=%%a!
>>"%LogFile%" echo   - %Drive%: ...
for /f "tokens=1,2*" %%a in ('reg.exe query "%Key%\%Drive%" ^| find.exe /i "REG_"') do (set %%a=%%c)
>>"%LogFile%" echo     Provider: %ProviderName%
>>"%LogFile%" echo     RemotePath: %RemotePath%
if /i not "%ProviderName%"=="Microsoft Windows Network" (
	>>"%LogFile%" echo   ... not a mapped drive, skipped.
	goto :eof
for /f "tokens=1* delims=\" %%a in ("%RemotePath%") do (
	set Server=%%a
	set Share=%%b
if /i "!Server:%OldServer%=!"=="%Server%" (
	>>"%LogFile%" echo   ... Server name '%OldServer%' not found, skipped.
	goto :eof
ECHO net.exe use %Drive%: /delete /yes >>"%LogFile%" 2>&1
ECHO net.exe use %Drive%: "\\!Server:%OldServer%=%NewServer%!\%Share%" /persistent:yes >>"%LogFile%" 2>&1
goto :eof

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Networking

From novice to tech pro — start learning today.