How can i change clients printers to look at new print server

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

Hi,

I was wondering if there was an easy way to remap printers
to a new print server automatically and remove all old
printers. The same share names exist on both servers for
the printers.

Thanks,
Jeff
 
Jeff,
I had to perform the same thing on my company's computers
so I created a vb script that remaps the client computers
printers. Copy the script code into a txt file and rename
the extension to .vbs. The client machine needs to have
the latest WMI and WSH installed on it. The script will
remap the users installed printers and delete the old
mappings. Of course the downfall of using a script is the
user has to be logged on at the time. I ended up using SMS
to distribute and run the script during the users log on.

Start the copy from 'run:

'run this vbscript on the client computer. The most
current WSH and WMI need to be installed on the client
machine.
On Error Resume Next
strComputer = "."
WSHversion = WScript.Version
'Check to see the computer has the latest Windows Script
Host installed
If WSHversion = "5.6" Then
Set objWMIService = GetObject("winmgmts:\\" & strComputer
& "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from
Win32_Printer",,48)
pServer = (objItem.ServerName)
For Each objItem in colItems

pShare = objItem.ShareName
pServer = UCase(objItem.ServerName)
'Change the \\wtprint01\ to your new print server
nServer = "\\WTPRINT01\"
cPrinter = pServer & "\" & pShare
nPrinter = nServer & pShare
cName = objItem.Name
' MsgBox("Current Servername is " & pServer)
'Change the \\wtprint02 to the existing printer server
If pServer = "\\WTPRINT02" Then
Set npc = CreateObject("WScript.Network")
npc.AddWindowsPrinterConnection nPrinter
Set rpc = WScript.CreateObject("WScript.Network")
' MsgBox(cPrinter)
'this will remove the old printer connections
rpc.RemovePrinterConnection cPrinter, True, True
Else
End if
' MsgBox(cPrinter)
Next
End if

Thanks,
Marc Junker
 
The script works great. However, how do you keep the same "default
printer on the new server??


-
Dennis31
 
Back
Top