2003 to 2008 print migrations - DNS issue

alliancemkt
alliancemkt used Ask the Experts™
on
Hello everyone,
I am in the process of migrating from a 2003 32 bit print server to a "multi-function" 2008 R2 64 bit print server.  It will be a DC, DHCP and DNS later.  (Forced consolidation)  For now, the focus is printers.  I used the print migration tool after I added all the 64 bit drivers, so both 32 and 64 would move.  Tested the new setup from a 32 and 64 bit workstation and all is good.  Now I want to seamlessy move all the users (~100) to the ~40 printers without having to touch every desktop.  I am *thinking* that I can just delete the Host(A) record of the old print server and create a new Host(A) record, then put in an alias from the old to the new name.  What else do I need to do in DNS?  Microsoft said something about registering with the KDD or there may be some errors.  Can I just delete, create, alias and go?

Am I leaving any "force update" etc. out of the procedure?

thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I had to do the same thing, I used this VBS script to update the users' printers when they logon. So their logon.bat script would fire this VBS script (below).

oldprintserver = "PRNTSERV1"
newprintserver = "PRNTSERV2"

On Error Resume Next

'Uncomment the next line for a standalone version of this script
Set WSHNetwork = WScript.CreateObject("Wscript.Network")

'Determine the default printer
Dim objShell
Dim sPath
Dim sPrinter
Dim sPort
Dim sDriver
Dim ar_PrnInfo
Dim defaultPrinterName
Set objShell = CreateObject("WScript.Shell")
sPath = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"
ar_PrnInfo = Split(objShell.RegRead(sPath), ",")
If IsArray(ar_PrnInfo) Then
sPrinter = ar_PrnInfo(0)
sPort = ar_PrnInfo(2)
sDriver = ar_PrnInfo(1)
End If
defaultPrinterName = UCase(sPrinter)

' loop through printer connections
Set WSHPrinters = WSHNetwork.EnumPrinterConnections
For LOOP_COUNTER = 0 To WSHPrinters.Count - 1 Step 2
    PrinterPath = UCase(WSHPrinters.Item(LOOP_COUNTER +1))
'Check for the old server in the path
    If InStr(3,PrinterPath,UCase(oldprintserver)) >0 Then
        'Replace the text
        NewPrinterPath = Replace(PrinterPath, UCase(oldprintserver), UCase(newprintserver))
        'Map the new printer
        WSHNetwork.AddWindowsPrinterConnection NewPrinterPath
        'Remove the old printer
        WSHNetwork.RemovePrinterConnection PrinterPath, True, True
    End If

Next

'if the users default printer is a printer on the old print server, the default printer
'is changed to the new print server
'if UCase(Mid(sPrinter, 2, Len(oldprintserver)+2)) = "\"& oldprintserver &"\" Then
     PrinterPath = "\\" & newprintserver & "\" & Mid(sPrinter, Len(oldprintserver)+4)
     WshNetwork.SetDefaultPrinter PrinterPath
'	WScript.echo PrinterPath
'	WScript.echo "WshNetwork.RemovePrinterConnection"  & ReplacePrinter

'End If

Open in new window


The nice thing about it is, it preserves the individual user's default printer.

Author

Commented:
Thanks for the scripts, but I thought that this could be accomplished through changes in DNS. For example, remove the old Host(A) record and add a CNAME alias pointing to the new host?  Are there any 'step by steps' out there that can make this seamless for the users?

Thanks!!
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

Nope, that won't work. In the end, the clients have to be updated. My script works perfectly, I used it to update a ton of clients to the new print server.

By the way, premglitz link above won't work - I tried it before polishing the script I ised.

Author

Commented:
OK.  I wasn't sure if the DNS CNAME idea was the route to take.

Thanks for the feedback, neilpage99.  I am a COMPLETE noobie to scripts.  From the looks of your (impressive) script, it appears that I only have to change the first two lines after the "="to the names of the old printer server and the new print server.  Is this all I have to change?  what is the "standalone" mode?  Is that to test it locally before adding it to the login?  How do I make it only run once or do I just leave it for a week, then after everyone has re-started, remove it?

Thanks in advance for your help.......
That script can and was used in conjunction with other properties and procedures; but that doesn't relate to you.

Yes, simply change the 'old' and 'new' print server to meet your needs. I call the script from a logon.bat script that each of my domain users have designated in their user account properties.

Here's an example of how to invoke it:

1. Make sure each user (that you want to update) has a "Logon script" designated in their "Profile" tab of their user properties in Active Directory Users and Computers (ADUC).

2. The "Logon script" can be several different things, I use a simple "logon.bat" file that maps network drives to important company resources, then launches the "update-printers.vbs" VBS script at the end. (that last part is what updates the user's printers to the new print server - which is the script I posted above.)  My logon.bat file would look similar to this:
NET USE G: /DELETE /y
NET USE P: /DELETE /y
NET USE G: \\server01\someapplication /persistent:yes
NET USE P: \\mycompany.local\general\departments /persistent:yes

cscript \\mycompany.local\SYSVOL\mycompany.local\scripts\update-printers.vbs

Open in new window


3. Both the "logon.bat" script and the "update-printers.vbs" script are placed in the:
\\mycompany.local\SYSVOL\mycompany.local\scripts\
...folder  This is a special folder that is replicated to all domain controllers in the domain. Your exact path will be different, but you get the idea.

4. When a user logs on to ANY computer/server, the logon script fires, which in turn will fire the update-printers.vbs script.

Yes, I left the scripts as they were for quite a while, just in case people were on vacation, out sick etc. It doesn't hurt anything to run the scripts on the same user over and over - but eventually, to be thorough, you will want to stop executing the update-printers.vbs script.

Author

Commented:
It sounds good so far!  Another quetions.  What if I want to take the opportunity during the migration to change the printer names?  Should I leave them as they are or does the script use the IP address??  Sorry, I am trying to grasp the script 'concept'.

Thanks

Author

Commented:
oops.  just to confirm.  I never noticed if the registry key is the same for XP, Win 7, 32 bit, 64 bit.  Is this an issue?

Author

Commented:
I think I comprehend the script commans for the printer and it does seem to look at the printername, so I will leave the names the same for the migration.

Thanks again for your patience and guidance!
Yes, this works for XP through Windows 7 64-bit or 32-bit.
Yes, the printer names must stay the same for the script to work.

Author

Commented:
okay.  I'll be testing out on a couple of PCs then roll it out.  Will let you know.

Thanks

Author

Commented:
Hi neilpage99,

I tested the VB script on my login and it didn't update my printers.  I have a WIN 7 and an XP test machine and neither updated.  I see the command running. Event log "Application" says Windows detected your registry file is still in use by other applications or services.  The applications or services that hold your registry file may not function properly afterwards.

I went back to the registry keys the VB Script should change and it still shows the old print server.

The VB script is in the "scripts" folder under sysvol and I tested the path by accessing it.
The command line is added to the login.bat file with our path in it.

Am I doing something wrong?
Start by saving the update-printers.vbs to your local test computers. Open a command window and change to the directory in which the script resides. Run the script from there; usually by typing the name of the script.

What happens?

The error you mentioned in the Application log might not be related.

Author

Commented:
Ok. I think I didn't do something I should have.  In the script you have a command line for "standalone".  I am assuming that I have this set wrong.  If it is on a DC, should that be "Commented" instead of Uncommented?

'Uncomment the next line for a standalone version of this script
Set WSHNetwork = WScript.CreateObject("Wscript.Network")

Should be?

'Uncomment the next line for a standalone version of this script
'Set WSHNetwork = WScript.CreateObject("Wscript.Network")

Author

Commented:
ok.  I tried it localy on the WIN7 pc and it worked.  So the script runs!  Excellent.

Now I just need to get it to run through the login.bat.

Is the issue with the "Uncomment" I mentioned above?
The only things you needed to change on the script were the names of the old and new print servers - everything else should remain the same. No need to make line 7 (way above) a comment, leave it uncommented.

Next, make sure the "USER" has in their AD User properties the correct logon.bat script identified, and that logon.bat script exists in the 'SYSVOL\mycompany.local\scripts\' folder.

Make sure at the end of the logon.bat file, the printers script is called in the form of:
cscript \\mycompany.local\SYSVOL\mycompany.local\scripts\update-printers.vbs

'cscript' being a critical part of the call.

Author

Commented:
It Worked!  thanks for the clarification.  I was using "\\Windows\SYSVOL........" instead of  "mycompany.local\SYSVOL\mycompany.local" portion.

thanks alot.  You sved me alot of work!!

Author

Commented:
Great job - and very patient with a 'noobie' to scripting.....  Thanks!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial