Printer Queues Moved to New Server

R

Ruteger

I have used Printer Migration 1.3 tool to move 61 queues to a new server with
a different AD name. I will take the current server offline at cutover. What
I want to know is the best way for my users who are currently mapped to the
old server and queues to print to the new server's printer queues? Will they
need to delete and re-map or is a script in order? I am trying not to have to
visit a 100 desktops to make the change.

Would it work if I renamed the new server to the OLD server name, and then
renamed back to the NEW server name? Would the user's mapped printers
recognize and adapt to the new server name? Thanks...
 
A

Alan Morris [MSFT]

Name the old server to Name.OLD then name the new server to the old server
name. The clients will reconnect.

Keep the old name, you will need to have all the clients connect to any new
server name. You could use aliasing to have multiple names for the new
server but you will have issue when adding drivers to the aliased names in
newer OS versions.

--
Alan Morris
Windows Printing Team
Search the Microsoft Knowledge Base here:
http://support.microsoft.com/search/?adv=1

This posting is provided "AS IS" with no warranties, and confers no rights.
 
R

Ruteger

Alan,

unfortunately I can't rename the new server back to the old server AD name
because the old server was named incorrectly, and the new name must reflect
government naming standards. So am I up a creek? :)

P.S. Will the printers on the new server be published in AD correctly? I
have heard Printer Migration tool sometimes doesn't work so well in this case.
 
A

Alex K. Angelopoulos

Ruteger,

I've prototyped a WSH logon-script-based solution for this situation, a
wholesale printer queue migration when you can't do the server rename trick.
Note I said "prototype" - if you're interested in using the approach, it
would be best to test on a few people if it can be staged correctly.

If you're interested, ping me offline and I can pass demo script over; I'd
like some extra validation since I'm writing an article about the technique.
Try me at aka(at)mvps.org.

A quickie intro: this actually uses a fairly simple bit of VBScript. You
just need to specify the old and new server name. You then chug through the
printer mappings returned from WScript.Network's EnumPrinterConnections()
method looking for \\oldname\. When it finds a match - which will be the UNC
path to the old printer queue - it copies the path, replaces \\oldserver\
with \\newserver\, and tries to connect with WScript.Network's
AddWindowsPrinterConnection(). If the connection attempt succeeds, it will
then (and only then) remove the old connection.
 
A

Alex K. Angelopoulos

For anyone trying to solve a similar issue with moving the ad-hoc end-user
printer connections over in the wake of a wholesale printserver migration,
here's a sample script that can help. The best solution, as Alan Morris
pointed out, is a server rename. If that's not an option (printers were on a
multi-role server still in use, name restrictions, etc) the following chunk
of VBScript can be used to remap Windows-based printer connections from the
old server to the new one.

I've made some comments inline about the process, but those and a couple of
other points are worth mentioning.
+ user customizations such as preferred printer and feature customization
don't get carried over; this is just a remap-and-delete;
+ You need to have identical names for the queues on the new server;
+ LPT/COM port redirection isn't handled;
+ If there are problems when the script is run - new server not available,
etc - there will be a several second delay for each connection attempt. To
mitigate the impact, the script will quit trying to remap queues after two
attempts have failed, and it never deletes the old queue until the new one
has been set.

dim net: Set net = CreateObject("WScript.Network")
OldPrintServer = "ws2003e02"
NewPrintServer = "PSrv2k8"

Dim PConnections
set PConnections = net.EnumPrinterConnections()

' Manually pad the names for the servers.
' Doing it this way should reduce administrator
' errors slightly.
' Or not. However, it lets us enter the names
' in a cleaner fashion and doesn't force people
' to remember where to put how many (\)s.
OldPrintRoot = "\\" & OldPrintServer & "\"
NewPrintRoot = "\\" & NewPrintServer & "\"


' Following reduces list to only UNC paths (or
' names for local printers)
Redim Queues(PConnections.count/2)
for i = 1 to PConnections.count step 2
Queues((i-1)/2) = PConnections(i)
next

' Reduce queues to ONLY those with the old print root
OldQueues = Filter(Queues, OldPrintRoot, True, vbTextCompare)
'WScript.Echo Join(OldQueues, vbCrLf)


' If NewPrintServer isn't up yet, there will be significant
' pause (15-45 sec) while AddWindowsPrinterConnection times out.
' for that reason, we want to quit trying if it doesn't work.
' The following loop tries to remap each queue. If it succeeds,
' the old mapping is deleted.
' If it fails for two queues during the process, we quit trying.
' This is intentional; you don't want a user with 10 print queues
' mapped to wait for 7-8 minutes while the logon script does nothing.

Dim failures: failures = 0
For Each OldQueue in OldQueues
NewQueue = Replace(OldQueue, OldPrintRoot, NewPrintRoot)
On Error Resume Next
Net.AddWindowsPrinterConnection(NewQueue)
'could test err.number, but this lets us stop
' error suppression immediately.
errnum = err.number
On Error Goto 0
if err.number = 0 Then
' remap succeeded; kill the old queue
' We want to force it if necessary, AND update profile.
Net.RemovePrinterConnection OldQueue, False, False
else
failures = failures + 1
' One failure might be a glitch. Two failures means
' a problem somewhere; stop slowing down progress
' and exit the For-Next loop.
'WScript.Echo Hex(Err.Number)
If failures > 1 Then Exit For
end if
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top