Re: Scripting Printers
From: Steve Seguis [MVP] (steve_NO_SPAM_at_scriptmation.com)
Date: 02/28/05
- Next message: Lost...: "IE Forms and VBS"
- Previous message: McKirahan: "Re: Import files in alphabetical order ?"
- Next in thread: Tarjei T. Jensen: "Re: Scripting Printers"
- Maybe reply: Tarjei T. Jensen: "Re: Scripting Printers"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 28 Feb 2005 04:04:23 GMT
Hi Brian,
Sorry I didn't get back to you right away. Sounds like a pretty interesting
problem but the solutions also seems fairly straight forward. I'm fairly
confident you can accomplish the task by exporting (or scripting the query
of) HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Printers.
-- Steve Seguis - MCSE, MVP Windows Server, SCJP SCRIPTMATION, INC. Automating the Enterprise http://www.scriptmation.com "Brian" <Brian@discussions.microsoft.com> wrote in message news:CFFC78B6-C61E-401A-BFC6-D9E00C7B921D@microsoft.com... > Yes we use it quite often. Here's the deal. A couple of years ago we > realized that when we installed let's say 200 printers we maxed out the > registery and the server would crash. Microsoft gave us a patch that > split > the printer section into two parts and allowed for a bigger registery so > we > could install 300 printers. Now when we run the printmig tool it get all > freaked out and doesn't understand how the printers are split. So I > really > just need some way to get the Port Name and IP address and then the Print > Driver name, Printer name, Printer location, and share name. Also I'm at > a > loss as to why the only sample script supported by NT is the List Printer > Capabilities. Can I install some sort of extensions or something on my NT > servers so I can run the other sample scripts against them? > > "Steve Seguis [MVP]" wrote: > >> Have you looked at the printmig.exe tool from the Windows Resource Kit? >> >> -- >> Steve Seguis - MCSE, MVP Windows Server, SCJP >> SCRIPTMATION, INC. >> Automating the Enterprise >> http://www.scriptmation.com >> >> >> "Brian" <Brian@discussions.microsoft.com> wrote in message >> news:E74AA925-04EA-45E4-8A5D-00D4BEA9573F@microsoft.com... >> >I have 6 NT servers with about 300 printers each on them. I need to >> >migrate >> > these printers to a 2003 box. I have a couple of scripts from Script >> > Center >> > that add a printer, add a port, list port properties and list printer >> > capabilities. The only problem is that NT only supports the List >> > printer >> > capabilitites. Does anyone know of a way that I can pull the necessary >> > port >> > and printer information from my NT servers so that I can add them back >> > to >> > my >> > 2003 server via script. >> > >> > Here are the sample scripts I'm starting from: >> > >> > List Printer Capabilities: >> > >> > strComputer = "." >> > Set objWMIService = GetObject("winmgmts:" _ >> > & "{impersonationLevel=impersonate}!\\" & strComputer & >> > "\root\cimv2") >> > >> > Set colInstalledPrinters = objWMIService.ExecQuery _ >> > ("Select * from Win32_PrinterConfiguration") >> > >> > For Each objPrinter in colInstalledPrinters >> > Wscript.Echo "Name: " & objPrinter.Name >> > Wscript.Echo "Collate: " & objPrinter.Collate >> > Wscript.Echo "Copies: " & objPrinter.Copies >> > Wscript.Echo "Driver Version: " & objPrinter.DriverVersion >> > Wscript.Echo "Duplex: " & objPrinter.Duplex >> > Wscript.Echo "Horizontal Resolution: " & _ >> > objPrinter.HorizontalResolution >> > If objPrinter.Orientation = 1 Then >> > strOrientation = "Portrait" >> > Else >> > strOrientation = "Landscape" >> > End If >> > Wscript.Echo "Orientation : " & strOrientation >> > Wscript.Echo "Paper Length: " & objPrinter.PaperLength / 254 >> > Wscript.Echo "Paper Width: " & objPrinter.PaperWidth / 254 >> > Wscript.Echo "Print Quality: " & objPrinter.PrintQuality >> > Wscript.Echo "Scale: " & objPrinter.Scale >> > Wscript.Echo "Specification Version: " & _ >> > objPrinter.SpecificationVersion >> > If objPrinter.TTOption = 1 Then >> > strTTOption = "Print TrueType fonts as graphics." >> > Elseif objPrinter.TTOption = 2 Then >> > strTTOption = "Download TrueType fonts as soft fonts." >> > Else >> > strTTOption = "Substitute device fonts for TrueType fonts." >> > End If >> > Wscript.Echo "True Type Option: " & strTTOption >> > Wscript.Echo "Vertical Resolution: " & objPrinter.VerticalResolution >> > Next >> > >> > ******************************************************* >> > >> > List Port Properties >> > >> > strComputer = "." >> > Set objWMIService = GetObject("winmgmts:" _ >> > & "{impersonationLevel=impersonate}!\\" & strComputer & >> > "\root\cimv2") >> > >> > Set colPorts = objWMIService.ExecQuery _ >> > ("Select * from Win32_TCPIPPrinterPort") >> > >> > For Each objPort in colPorts >> > Wscript.Echo "Description: " & objPort.Description >> > Wscript.Echo "Host Address: " & objPort.HostAddress >> > Wscript.Echo "Name: " & objPort.Name >> > Wscript.Echo "Port Number: " & objPort.PortNumber >> > Wscript.Echo "Protocol: " & objPort.Protocol >> > Wscript.Echo "SNMP Community: " & objPort.SNMPCommunity >> > Wscript.Echo "SNMP Dev Index: " & objPort.SnMPDevIndex >> > Wscript.Echo "SNMP Enabled: " & objPort.SNMPEnabled >> > Next >> > ****************************************************** >> > Install a Printer: >> > >> > strComputer = "." >> > Set objWMIService = GetObject("winmgmts:" _ >> > & "{impersonationLevel=impersonate}!\\" & strComputer & >> > "\root\cimv2") >> > >> > Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_ >> > >> > objPrinter.DriverName = "HP LaserJet 4000 Series PS" >> > objPrinter.PortName = "IP_169.254.110.160" >> > objPrinter.DeviceID = "ScriptedPrinter" >> > objPrinter.Location = "USA/Redmond/Building 37/Room 114" >> > objPrinter.Network = True >> > objPrinter.Shared = True >> > objPrinter.ShareName = "ScriptedPrinter" >> > objPrinter.Put_ >> > >> > ***************************************************** >> > Install a Printer Port: >> > >> > Set objWMIService = GetObject("winmgmts:" _ >> > & "{impersonationLevel=impersonate}!\\" & strComputer & >> > "\root\cimv2") >> > Set objNewPort = objWMIService.Get _ >> > ("Win32_TCPIPPrinterPort").SpawnInstance_ >> > >> > objNewPort.Name = "IP_169.254.110.14" >> > objNewPort.Protocol = 1 >> > objNewPort.HostAddress = "169.254.110.14" >> > objNewPort.PortNumber = "9999" >> > objNewPort.SNMPEnabled = False >> > objNewPort.Put_ >> > >> > >> > -- >> > Thanks for the help! >> > Brian >> >> >>
- Next message: Lost...: "IE Forms and VBS"
- Previous message: McKirahan: "Re: Import files in alphabetical order ?"
- Next in thread: Tarjei T. Jensen: "Re: Scripting Printers"
- Maybe reply: Tarjei T. Jensen: "Re: Scripting Printers"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|