Need script to replace %oldservername% mapped drives with %newservername% Server 2003

Posted on 2004-10-07
Last Modified: 2010-04-17
Hi all
I just need a script to replace all %oldservername% mapped drives to new %servername% mapped drives persistently. Can anyone help please?
Question by:chillinlong
  • 4
  • 3
LVL 41

Expert Comment

ID: 12255308
I've got a solution that quite a lot more complicated than that...  but you might find bits of it helpful (or at least amusing)

In my case, I had to rename all of my PCs and Servers.  That meant that I had a few hundred PCs that needed the following:

LVL 41

Expert Comment

ID: 12255347
...hey I didn't mean to hit Enter (so let me continue!)

That meant that I had a few hundred PCs that needed the following:

a) needed to be renamed
b) needed all mapped network drives/printer changed for all users on each PC (they are a per-user setting)
c) needed all of the shortcuts changed (where ever they are on the PC)
d) needed a registry "search and replace" for such things as installed software paths, etc.

So, I created a VB.Net program that runs at the login batch file... that does all of those things.  It uses a database of "before and after" names of servers (and ordinary PC that have file or print shares) to do it's magic.

The entire package is available at and contains the VB.Net source code, overview, documentation, sample database, etc.   It does NOT include the actual program itself... you'll have to get someone with VB.Net to compile the program for you.

Hey, I'll admit... it's a bit of overkill for what you're asking, but  you're welcome to take a look, and use whatever you like.

Author Comment

ID: 12257475
Thanks for your input, it just seems a bit too much for the mapped drives to reconnect to a new server to have too install .net functions on all client machines to just run the script etc.

Preferably I need a small vbs script which will disconnect
%oldservername% to and edit to %newservername% only on mapped drives and persistent connection.

Thanks again for your help.

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

LVL 41

Accepted Solution

graye earned 100 total points
ID: 12257732
Yeah, I kinda thought that might be the case...  Oh well.

So, are you sure you don't have PCs that have shortcuts scattered about their drives that point to the old server?

Also, remember that mapped drive letters are stored in the registry for each user on the PC... so if you have a shared PC, you'll have to fix the mapped drives for each user.  That's the part of the solution that's tought to do with a script... it'd be difficult for a script to mount all of the user's registry "hives" so that the script could fix the mapped drives.  The alternative would be to run the script for each user that logs on.

You guys don't already have the .Net Framework installed on your client PCs ?!?!?!

Hey, I'm not trying to convince you of anything... just pointing out the pitfalls of what seems to be a simple problem with a simple solution.

Author Comment

ID: 12272978
Ah well nobody else has answered.

Thanks again for your response you can have the points for the effort you made cheers again.

Author Comment

ID: 12792582
I seem to be struglling trying to run this vbs files you mentioned. I appreaciate there is a manual but I still cannot find the programs to make these scripts work.

Where do I start please?

LVL 41

Expert Comment

ID: 12799763
We typically only distribute "source code"... not complete applications.   So the files that are available on our web site require the Visual Studio .Net 2003 package to compile the source code into programs that you can use.

That means you're gonna have to find somebody with Visual Studio .Net 2003 installed to compile it for you.   Sorry about that

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
A short article about problems I had with the new location API and permissions in Marshmallow
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now