Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We are in the progress of migrating to a new file and print server that has a different name to the old server. we have a lot of mapped drives based on departments as well as a lot of printers. I was just wondering what would be (in your opinion) the best way to change all references to the old server to the new one on the clients machine?

Thanks.

share|improve this question

1 Answer 1

To change mapped drive references, you could write a very simply VBScript that would remap these, and execute it as a logon script. Same for the printers.

I would then create a CNAME record on your DNS server pointing oldFileServer to newFileServer (just in case)

EDIT: You don't change the CNAME. 1) Start up new server. 2) Switch off old server 3) Delete DNS A record for oldFileServer.myDomain.loc 4) Add CNAME record pointing oldFileServer.myDomain.loc to newFileServer.myDomain.loc

As for a sample script, here's one a colleague put together when we migrated our 15 print servers. Just replace the \\oldPrintServer bit, the \\oldPrintServer.myDomain.loc bit, and \\newPrintServer bit. You would then need to call this as a logon script for the user (either via the User Account in AD, from an existing logon script, or via GPO)

Option Explicit
On Error Resume Next

MigratePrint("\\oldPrintServer")
MigratePrint("\\oldPrintServer.myDomain.loc")

Function MigratePrint(strOldServer)

Dim strComputer
Dim strShareName
Dim objWMIService
Dim objPrinter
Dim objItem
Dim colItems
Dim WshNetwork
Dim strNewServer

strComputer = "."
strNewServer="\\newPrintServer"

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Printer",,48)

For Each objItem in colItems
    If objItem.ServerName = strOldServer Then   
    	If objItem.Default = "True" Then
    		strShareName = objItem.ShareName
    	End If
    	WshNetwork.RemovePrinterConnection objItem.ServerName & "\" & objItem.ShareName, True, True
    	WshNetwork.AddWindowsPrinterConnection strNewServer & "\" &  objItem.Sharename
    End If
Next

Set objPrinter = CreateObject("WScript.Network") 
objPrinter.SetDefaultPrinter (strNewServer & "\" & strShareName)


End Function
share|improve this answer
    
You dont happen to have an example do you (of the VB script that is) In our testing when we changed the CNAME when you try to open a network share/mapped drive it comes back with "the local device name is already in use" thanks for your help. –  philosoraptor Oct 24 '09 at 5:10
    
Thanks so much that worked perfectly, just need to work out how to do it for mapped drives now. –  philosoraptor Oct 24 '09 at 6:05
    
I'm not going to write it for you, but using these three resources, you should be able to piece together the script (using the same logic as the print server one): blogs.technet.com/heyscriptingguy/archive/2005/10/27/… msdn.microsoft.com/en-us/library/aa394173(VS.85).aspx blogs.technet.com/heyscriptingguy/archive/2006/11/13/… –  Izzy Oct 24 '09 at 6:29
1  
+1 Just for correctly guessing the OS with so little to go on. –  John Gardeniers Oct 24 '09 at 7:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.