|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
New print server/vb scriptI am planning on moving all the printer form a dedicated print server to a
new File server. The goal is to remove the old print (Printserv01) server from the network and to make new file server (Fileserv01) as a print serve. My question is, how do I clear or remove the old printer settings from the client machines and install the new without going desk to desk? all printers were mapped manually. Currently I have a VB script runing that mapps nework drivers using GPO. If it is possible I would like to remove and add printer VB script to the existing script. Thank you, This is certainly doable with a vbscript.
Below is a script that I used to use as a logon script that will do this. I've chopped out bits from a larger script so it might be a bit incoherent, but it should do the trick or at least get you on the right track. Another way of doing it could be to migrate the printers to the new server using printmig 3.0, then add a CNAME for the new server with the old server's name. Then assuming the share names are the same, printing to an old server will cause the print job to pop out on the printer. Note for this idea to work you will have to disable strict name checking on the lanmanserver service. http://support.microsoft.com/kb/281308 -->8 Option Explicit ' ------------------------------------------------------------ ' Declarations & Constants ' ------------------------------------------------------------ Dim WshShell, WshNetwork, WshSysEnv Dim Group, adsPath, adsObj, Member, strUser, strLF, strTab, strDomain, objUser, Property strLF = Chr(13) strTab = Chr(9) strDomain = "DOMAIN" Set WshShell = WScript.CreateObject("WScript.Shell") Set WshNetwork = WScript.CreateObject("WScript.Network") ' ------------------------------------------------------------ Sub Connect_Printers() 'on error resume next 'Get list of clients Printers and remove any old ones... RemovedPrinters = "" oldprinter1Status = "Not Found" oldprinter2Status = "Not Found" oldprinter3Status = "Not Found" Set clPrinters = WshNetwork.EnumPrinterConnections For i = 0 to clPrinters.Count -1 If instr(1, clprinters.item(i), "oldserver", 1) > 0 then WSHNetwork.RemovePrinterconnection clPrinters.Item(i) RemovedPrinters = RemovedPrinters & clPrinters.Item(i) & chr(13) End if Select Case clPrinters.Item(i) Case "\\server\oldprinter1" oldprinter1Status = "Found" Case "\\server\oldprinter2" oldprinter2Status = "Found" Case "\\server\oldprinter3" oldprinter3Status = "Found" End Select Next 'Add Printers that aren't there AddedPrinters = "" If oldprinter1Status <> "Found" then WSHNetwork.AddWindowsPrinterConnection "\\newserver\newprinter1" WSHNetwork.SetDefaultPrinter "\\newserver\newprinter1" End if IF oldprinter2Status <> "Found" then WSHNetwork.AddWindowsPrinterConnection "\\newserver\newprinter2" AddedPrinters = AddedPrinters & "\\newserver\newprinter2" & chr(13) End if If oldprinter3Status <> "Found" then WSHNetwork.AddWindowsPrinterConnection "\\newserver\newprinter3" AddedPrinters = AddedPrinters & "\\newserver\newprinter3" & chr(13) End if End Sub ' ------------------------------------------------------------ Sub CleanUp() set WshShell = Nothing set WshNetwork = Nothing set group = Nothing set adspath = Nothing set adsobj = Nothing set member = Nothing set struser = Nothing End Sub ' ------------------------------------------------------------ ' Main Script ' ------------------------------------------------------------ ' Get UserName strUser = WSHNetwork.UserName strDomain = WSHNetwork.UserDomain call Connect_Printers() call CleanUp() -->8 Show quoteHide quote "Lino" <L***@discussions.microsoft.com> wrote in message news:09CD1B3A-0AC5-4865-9FD6-2DE533D8DC7C@microsoft.com... >I am planning on moving all the printer form a dedicated print server to a > new File server. The goal is to remove the old print (Printserv01) server > from the network and to make new file server (Fileserv01) as a print > serve. > My question is, how do I clear or remove the old printer settings from the > client machines and install the new without going desk to desk? all > printers > were mapped manually. Currently I have a VB script runing that mapps > nework > drivers using GPO. If it is possible I would like to remove and add > printer > VB script to the existing script. > > Thank you, |
|||||||||||||||||||||||