Print Server Migration

R

RLantacon

Since all of the user workstations have their
printers pointed toward the old print server is there an easy way to
migrate
those printers over to the new system AND make it an easy transition
for
users so that they have no idea they are printing to a different
print
server?
 
A

Alan Morris [MSFT]

here is some info posted in the server.scripting newsgroup
----------------

This is the script that I used for similar situation. I don't remeber where
I
found the script but the author has saved me countless hours. The author
included instructions in the script itself, this script requires a separate
text file, I put both files (script+translate text file) in the netlogon
folder and then execute the script from the login script.

ex. start \\logonserver\netlogon\chgPrint.vbs


'===========================================================
' NAME: W2kChgPrint.vbs
' COMMENT: This is a sample script
' For the purpose of updating W2K and WinXP clients UNC printers
' to a new UNC printer path.
' This script is designed to handle the following format only
' <old UNC printer> <new UNC printer>
' \\server1\shareA \\server2\shareC
' \\server1\shareB \\serverX\ShareB
'
' NOTES:
' Do not add blank spaces. Both original and new UNC printer path must
' be included.
' One tab only between original UNC printer path and new UNC printer path
' The line in the script "TranslateFile =..." should be updated
'========================================================
Option Explicit
'On error Resume Next

Dim TranslateFile 'File that stores the old printer path and new printer
path
TranslateFile = "\\SERVER\NETLOGON\PATH_TO\TranslatePrinter.txt"
Dim dict 'The dictionary object, dict.item() points to the new printer
Dim Key 'The dictionary key to each item

Dim PrinterPath 'Contains the Path to the original printer, ie
\\server\share
Dim objLocator, objService, objEnumerator
Dim objWSH, strComputerName

Set objWSH = CreateObject("WScript.Network")
strComputerName = objWSH.ComputerName

set objLocator = CreateObject("WbemScripting.SWbemLocator")
set objService = objLocator.ConnectServer (strComputerName,"root/cimv2")
set objEnumerator = objService.ExecQuery("SELECT * FROM win32_Printer")

Set dict = CreateObject("Scripting.Dictionary")
CreateDictionary 'Populate the dictionary object

For each key in objEnumerator
'enumerated from local system
PrinterPath = Ucase(key.ServerName & "\" & key.ShareName)
If dict.Exists (PrinterPath) Then
'if PrinterPath matches dictionary item
objWSH.AddWindowsPrinterConnection dict.item(PrinterPath)
'Add printer in dictionary that matches PrinterPath
If (ucase(GetDefaultPrinter()) = ucase(key.name)) then
objWSH.SetDefaultPrinter dict.item(PrinterPath)
End if
'This line deletes old printer
objWSH.RemovePrinterConnection PrinterPath, true, true
End if
Next

'** This function returns the name of the printer
'** ie "\\server\HP Laser Jet 2100"
Function GetDefaultPrinter()
Dim RegPath 'Location that stores users Default Printer
Dim Loc 'Used to locate the comma after the printer name
Dim DefaultPrinter 'Temporary stores the data read from RegPath
DIM WSHShell 'Windows Scripting Host object

Set WSHShell = WScript.CreateObject("WScript.Shell")
RegPath = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"
'If we error out reading Default printer will be nothing
GetDefaultPrinter=""

'Script should continue running even if registry data is not found
On Error Resume Next
DefaultPrinter = WSHShell.RegRead(RegPath)
Loc = instr(3,DefaultPrinter,",",vbTextCompare)
GetDefaultPrinter = Mid(DefaultPrinter,1,loc - 1)
End Function

'** This fuction adds the Translatefile.txt into a dictionary object
'** The original \\server\share is assigned to the dictionary Key (like
'** a database)
'** The destination \\server\share becomes the associated Item to the Key
'** If you do not like dictionary objects you could use a 2 dimensional
'** array instead
Function CreateDictionary()
Dim File, FSO, Line, OrgPrinter, NewPrinter, Loc
Set FSO = CreateObject("Scripting.FileSystemObject")
Set File = FSO.OpenTextFile (TranslateFile, 1)
While not File.AtEndOfStream 'Loop until the end of the file is read
Line = Ucase(File.ReadLine) 'Read line of text from the file
Loc = instr(1,Line,chr(9),vbTextCompare) 'Find the tab in the line read
'Do not add line to dictionary if Tab not found
if Loc > 3 then
'contents before tab is the original \\server\share
OrgPrinter = Mid(Line,1,Loc -1)
'Contents after tab is the destination \\server\share
NewPrinter = Mid(Line,Loc +1)
'adds another set of "Key, Item" to the dictionary
dict.Add OrgPrinter, NewPrinter
end if
WEnd
End Function


Rob said:
Background

We have two Print servers.
One = windows 2003
One = Windows NT

We want to decomission the Windows NT print server, as the Windows 2003 is
alot better. Better Hardware and Software. While some of the queues are
identical on each server, some are not.. And most importantly, I need to
enumerate all the Users/Workstations that use the old NT print server.
Then
remap to the new server.
Is this doable via a script, and if so What is it?
Can it run against a user id via login script and write to a text or excel
spreadsheet?

--
Alan Morris
Windows Printing Team
Search the Microsoft Knowledge Base here:
http://support.microsoft.com/default.aspx?scid=fh;[ln];kbhowto

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

Guest

Hi Alan,

Has anyone else tested this script ? I seem to see the same person (Kirk)
mentioning it. Google'd the script, and theres not many answers to if alot
of people have tried it.

Alan Morris said:
here is some info posted in the server.scripting newsgroup
----------------

This is the script that I used for similar situation. I don't remeber where
I
found the script but the author has saved me countless hours. The author
included instructions in the script itself, this script requires a separate
text file, I put both files (script+translate text file) in the netlogon
folder and then execute the script from the login script.

ex. start \\logonserver\netlogon\chgPrint.vbs


'===========================================================
' NAME: W2kChgPrint.vbs
' COMMENT: This is a sample script
' For the purpose of updating W2K and WinXP clients UNC printers
' to a new UNC printer path.
' This script is designed to handle the following format only
' <old UNC printer> <new UNC printer>
' \\server1\shareA \\server2\shareC
' \\server1\shareB \\serverX\ShareB
'
' NOTES:
' Do not add blank spaces. Both original and new UNC printer path must
' be included.
' One tab only between original UNC printer path and new UNC printer path
' The line in the script "TranslateFile =..." should be updated
'========================================================
Option Explicit
'On error Resume Next

Dim TranslateFile 'File that stores the old printer path and new printer
path
TranslateFile = "\\SERVER\NETLOGON\PATH_TO\TranslatePrinter.txt"
Dim dict 'The dictionary object, dict.item() points to the new printer
Dim Key 'The dictionary key to each item

Dim PrinterPath 'Contains the Path to the original printer, ie
\\server\share
Dim objLocator, objService, objEnumerator
Dim objWSH, strComputerName

Set objWSH = CreateObject("WScript.Network")
strComputerName = objWSH.ComputerName

set objLocator = CreateObject("WbemScripting.SWbemLocator")
set objService = objLocator.ConnectServer (strComputerName,"root/cimv2")
set objEnumerator = objService.ExecQuery("SELECT * FROM win32_Printer")

Set dict = CreateObject("Scripting.Dictionary")
CreateDictionary 'Populate the dictionary object

For each key in objEnumerator
'enumerated from local system
PrinterPath = Ucase(key.ServerName & "\" & key.ShareName)
If dict.Exists (PrinterPath) Then
'if PrinterPath matches dictionary item
objWSH.AddWindowsPrinterConnection dict.item(PrinterPath)
'Add printer in dictionary that matches PrinterPath
If (ucase(GetDefaultPrinter()) = ucase(key.name)) then
objWSH.SetDefaultPrinter dict.item(PrinterPath)
End if
'This line deletes old printer
objWSH.RemovePrinterConnection PrinterPath, true, true
End if
Next

'** This function returns the name of the printer
'** ie "\\server\HP Laser Jet 2100"
Function GetDefaultPrinter()
Dim RegPath 'Location that stores users Default Printer
Dim Loc 'Used to locate the comma after the printer name
Dim DefaultPrinter 'Temporary stores the data read from RegPath
DIM WSHShell 'Windows Scripting Host object

Set WSHShell = WScript.CreateObject("WScript.Shell")
RegPath = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"
'If we error out reading Default printer will be nothing
GetDefaultPrinter=""

'Script should continue running even if registry data is not found
On Error Resume Next
DefaultPrinter = WSHShell.RegRead(RegPath)
Loc = instr(3,DefaultPrinter,",",vbTextCompare)
GetDefaultPrinter = Mid(DefaultPrinter,1,loc - 1)
End Function

'** This fuction adds the Translatefile.txt into a dictionary object
'** The original \\server\share is assigned to the dictionary Key (like
'** a database)
'** The destination \\server\share becomes the associated Item to the Key
'** If you do not like dictionary objects you could use a 2 dimensional
'** array instead
Function CreateDictionary()
Dim File, FSO, Line, OrgPrinter, NewPrinter, Loc
Set FSO = CreateObject("Scripting.FileSystemObject")
Set File = FSO.OpenTextFile (TranslateFile, 1)
While not File.AtEndOfStream 'Loop until the end of the file is read
Line = Ucase(File.ReadLine) 'Read line of text from the file
Loc = instr(1,Line,chr(9),vbTextCompare) 'Find the tab in the line read
'Do not add line to dictionary if Tab not found
if Loc > 3 then
'contents before tab is the original \\server\share
OrgPrinter = Mid(Line,1,Loc -1)
'Contents after tab is the destination \\server\share
NewPrinter = Mid(Line,Loc +1)
'adds another set of "Key, Item" to the dictionary
dict.Add OrgPrinter, NewPrinter
end if
WEnd
End Function


Rob said:
Background

We have two Print servers.
One = windows 2003
One = Windows NT

We want to decomission the Windows NT print server, as the Windows 2003 is
alot better. Better Hardware and Software. While some of the queues are
identical on each server, some are not.. And most importantly, I need to
enumerate all the Users/Workstations that use the old NT print server.
Then
remap to the new server.
Is this doable via a script, and if so What is it?
Can it run against a user id via login script and write to a text or excel
spreadsheet?

--
Alan Morris
Windows Printing Team
Search the Microsoft Knowledge Base here:
http://support.microsoft.com/default.aspx?scid=fh;[ln];kbhowto

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

Since all of the user workstations have their
printers pointed toward the old print server is there an easy way to
migrate
those printers over to the new system AND make it an easy transition
for
users so that they have no idea they are printing to a different
print
server?
 
A

Alan Morris [MSFT]

It's been around for years. I am sure someone has used it. If it does not
work for you, that okay.

--
Alan Morris
Windows Printing Team
Search the Microsoft Knowledge Base here:
http://support.microsoft.com/default.aspx?scid=fh;[ln];kbhowto

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

B. Cheung said:
Hi Alan,

Has anyone else tested this script ? I seem to see the same person (Kirk)
mentioning it. Google'd the script, and theres not many answers to if
alot
of people have tried it.

Alan Morris said:
here is some info posted in the server.scripting newsgroup
----------------

This is the script that I used for similar situation. I don't remeber
where
I
found the script but the author has saved me countless hours. The author
included instructions in the script itself, this script requires a
separate
text file, I put both files (script+translate text file) in the netlogon
folder and then execute the script from the login script.

ex. start \\logonserver\netlogon\chgPrint.vbs


'===========================================================
' NAME: W2kChgPrint.vbs
' COMMENT: This is a sample script
' For the purpose of updating W2K and WinXP clients UNC
printers
' to a new UNC printer path.
' This script is designed to handle the following format only
' <old UNC printer> <new UNC printer>
' \\server1\shareA \\server2\shareC
' \\server1\shareB \\serverX\ShareB
'
' NOTES:
' Do not add blank spaces. Both original and new UNC printer path must
' be included.
' One tab only between original UNC printer path and new UNC printer
path
' The line in the script "TranslateFile =..." should be updated
'========================================================
Option Explicit
'On error Resume Next

Dim TranslateFile 'File that stores the old printer path and new printer
path
TranslateFile = "\\SERVER\NETLOGON\PATH_TO\TranslatePrinter.txt"
Dim dict 'The dictionary object, dict.item() points to the new printer
Dim Key 'The dictionary key to each item

Dim PrinterPath 'Contains the Path to the original printer, ie
\\server\share
Dim objLocator, objService, objEnumerator
Dim objWSH, strComputerName

Set objWSH = CreateObject("WScript.Network")
strComputerName = objWSH.ComputerName

set objLocator = CreateObject("WbemScripting.SWbemLocator")
set objService = objLocator.ConnectServer (strComputerName,"root/cimv2")
set objEnumerator = objService.ExecQuery("SELECT * FROM win32_Printer")

Set dict = CreateObject("Scripting.Dictionary")
CreateDictionary 'Populate the dictionary object

For each key in objEnumerator
'enumerated from local system
PrinterPath = Ucase(key.ServerName & "\" & key.ShareName)
If dict.Exists (PrinterPath) Then
'if PrinterPath matches dictionary item
objWSH.AddWindowsPrinterConnection dict.item(PrinterPath)
'Add printer in dictionary that matches PrinterPath
If (ucase(GetDefaultPrinter()) = ucase(key.name)) then
objWSH.SetDefaultPrinter dict.item(PrinterPath)
End if
'This line deletes old printer
objWSH.RemovePrinterConnection PrinterPath, true, true
End if
Next

'** This function returns the name of the printer
'** ie "\\server\HP Laser Jet 2100"
Function GetDefaultPrinter()
Dim RegPath 'Location that stores users Default Printer
Dim Loc 'Used to locate the comma after the printer name
Dim DefaultPrinter 'Temporary stores the data read from RegPath
DIM WSHShell 'Windows Scripting Host object

Set WSHShell = WScript.CreateObject("WScript.Shell")
RegPath = "HKCU\Software\Microsoft\Windows
NT\CurrentVersion\Windows\Device"
'If we error out reading Default printer will be nothing
GetDefaultPrinter=""

'Script should continue running even if registry data is not found
On Error Resume Next
DefaultPrinter = WSHShell.RegRead(RegPath)
Loc = instr(3,DefaultPrinter,",",vbTextCompare)
GetDefaultPrinter = Mid(DefaultPrinter,1,loc - 1)
End Function

'** This fuction adds the Translatefile.txt into a dictionary object
'** The original \\server\share is assigned to the dictionary Key (like
'** a database)
'** The destination \\server\share becomes the associated Item to the Key
'** If you do not like dictionary objects you could use a 2 dimensional
'** array instead
Function CreateDictionary()
Dim File, FSO, Line, OrgPrinter, NewPrinter, Loc
Set FSO = CreateObject("Scripting.FileSystemObject")
Set File = FSO.OpenTextFile (TranslateFile, 1)
While not File.AtEndOfStream 'Loop until the end of the file is
read
Line = Ucase(File.ReadLine) 'Read line of text from the file
Loc = instr(1,Line,chr(9),vbTextCompare) 'Find the tab in the line read
'Do not add line to dictionary if Tab not found
if Loc > 3 then
'contents before tab is the original \\server\share
OrgPrinter = Mid(Line,1,Loc -1)
'Contents after tab is the destination \\server\share
NewPrinter = Mid(Line,Loc +1)
'adds another set of "Key, Item" to the dictionary
dict.Add OrgPrinter, NewPrinter
end if
WEnd
End Function


Rob said:
Background

We have two Print servers.
One = windows 2003
One = Windows NT

We want to decomission the Windows NT print server, as the Windows 2003
is
alot better. Better Hardware and Software. While some of the queues are
identical on each server, some are not.. And most importantly, I need
to
enumerate all the Users/Workstations that use the old NT print server.
Then
remap to the new server.
Is this doable via a script, and if so What is it?
Can it run against a user id via login script and write to a text or
excel
spreadsheet?

--
Alan Morris
Windows Printing Team
Search the Microsoft Knowledge Base here:
http://support.microsoft.com/default.aspx?scid=fh;[ln];kbhowto

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

Since all of the user workstations have their
printers pointed toward the old print server is there an easy way to
migrate
those printers over to the new system AND make it an easy transition
for
users so that they have no idea they are printing to a different
print
server?
 

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