silver74 Posted September 15, 2006 Posted September 15, 2006 (edited) Hello,we will changed nearly other printer,he works with tcp/ip.So il will delete the old one to install the new one.But i go to make this on 70 pc's.So i hope ,to make this with the wipw.But i dont now how to make this. The new Printer can print forside and backside so i will activated this directly,is this possible?Thanks,silver74 Edited September 15, 2006 by silver74
lawrenca Posted September 16, 2006 Posted September 16, 2006 (edited) @silver74,Many ways to do this one,1. Command line option straight from the cmd within wpi or run from bat.RUNDLL32 PRINTUI.DLL,PrintUIEntry [ options ] [ @commandfile ] Type "rundll32 printui.dll,PrintUIEntry /?" at the run command or command prompt for more help.See this link for more info:PrintUI2. Run from vbscriptSee samples at this link, just piece together the steps you are interested in and use this for your command: "wscript.exe "Your .vbs file here""Manage Printers via Script3. See this cool tool from Microsoft, definately a nice tool to have around. Set your Master machine up once, backup those drivers, then restore those defaults to any other system. Silent commands can be found by typing printmig.exe /? at a command prompt.Print Migrator 3.1Hope this helps Edited September 16, 2006 by lawrenca
IcemanND Posted September 16, 2006 Posted September 16, 2006 I don't know about using WPI but it's easy enough to do with vbscript. Does the printer driver exist in the default windows printer drivers or does it need to be added?
silver74 Posted September 16, 2006 Author Posted September 16, 2006 I think it dosn't existe,because et a "new" model (hp laserjet 1320).Can you tell me mor how to use these vbscripts?I dont know how does it works
IcemanND Posted September 17, 2006 Posted September 17, 2006 Delete a printer:strComputer = "."Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set colInstalledPrinters = objWMIService.ExecQuery _ ("Select * from Win32_Printer where DeviceID = 'ScriptedPrinter'") <-- Change ScriptedPrinted to the friendly name of the printer you want to deleteFor Each objPrinter in colInstalledPrinters objPrinter.Delete_NextFor a printer which the drivers exist in the installed ntprint.inf (part of the windows install)strComputer = "."Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")set objNewPort = objWMIService.get("Win32_TCPIPPrinterPort").SpawnInstance_Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", TrueSet objDriver = objWMIService.Get("Win32_PrinterDriver")'Laserjet 4000 'Installs Printer Driver objDriver.Name = "HP LaserJet 4000 Series PS" <-- Change to match the driver name in the INF objDriver.SupportedPlatform = "Windows NT x86" objDriver.Version = "3" intResult = objDriver.AddPrinterDriver(objDriver) 'Installs Printer Port objNewPort.Name = "myprinter.mydomain.com" <-- change to match the port name or address objNewPort.Protocol = 1 objNewPort.HostAddress = "myprinter.mydomain.com" <-- change to match the port name or address objNewPort.PortNumber = 9100 <-- Change to appropriate port number if needed objNewPort.SNMPEnabled = True objNewPort.Put_ 'Install Printer objPrinter.DriverName = "HP LaserJet 4000 Series PS" <-- change to match the driver name in the INF same as first line above objPrinter.PortName = "myprinter.mydomain.com" <-- name of the port you created above objPrinter.DeviceID = "My LJ4000" <-- Friendly name displayed in control panel objPrinter.Location = "" objPrinter.Network = True objPrinter.Put_Install a printer that the driver is NOT in ntprint.infstrComputer = "."Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")set objNewPort = objWMIService.get("Win32_TCPIPPrinterPort").SpawnInstance_Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", TrueSet objDriver = objWMIService.Get("Win32_PrinterDriver") objDriver.Name = "HP LaserJet 4250 PS" <-- Driver name in INF file objDriver.SupportedPlatform = "Windows NT x86" objDriver.Version = "3" objDriver.FilePath = "C:\\drivers\\lj4250ps\\" <-- Path to inf file objDriver.Infname = "C:\\drivers\\lj4250ps\\hpc4x50d.inf" <-- Path and name if inf file intResult = objDriver.AddPrinterDriver(objDriver) 'Installs Printer Port objNewPort.Name = "192.168.1.100" <-- change to the port address or name objNewPort.Protocol = 1 objNewPort.HostAddress = "192.168.1.100" <-- change to the port address or name objNewPort.PortNumber = 9100 <-- Change to appropriate port number if needed objNewPort.SNMPEnabled = True objNewPort.Put_ 'Install Printer objPrinter.DriverName = "HP LaserJet 4250 PS" <-- change to match the driver name in the INF same as first line above objPrinter.PortName = "192.168.1.100" <-- change to the port address or name objPrinter.DeviceID = "My LJ4250" <-- Friendly name displayed in control panel objPrinter.Location = "" objPrinter.Network = True objPrinter.Put_Save the contents of the appropriate quote above to say add_printer.vbs then double click or add as a startup script or however you want to do it. If needed you can add the delte script and the add scripts into one just don't duplicate the lines that begin with SET that are the same.
silver74 Posted September 20, 2006 Author Posted September 20, 2006 Many thanks to lawrenca and IcemanND If have deleted all mi printers,with the vbs and install my printer via MS Printer migrator from wpiw.It works perfectlyl!!! But only on thing i dont now how to make.I want to save the configuration from the printer with default recto/verso(front-and backside print) and ecomode.I think is in a regfile but i dont find it, what key must be saved to be after insert . Somebody can help me?
lawrenca Posted September 20, 2006 Posted September 20, 2006 @silver74,The Printer Migration Tool should support multiple configurations for the same printer...just add a printer for each seperate profile/configuration making sure you give them detailed names so you know which is which.Example:Port added as standard TCP/IP address, 192.168.1.201HP5500 PS NetDuplex <--Points to the address above with Duplexing using Postscript Drivers on 8.5x11HP5500 PCL 6 Net <--Same printer without Duplexing using PCL 6 Drivers on 8.5x11 paperHP5500 PS Net 11x17 <--Same printer but no Duplexing using Postscript Drivers on 11x17 paperThe key, of course is, you would have to use the Add Printer Wizard, then make sure you have configured the printers and that they are working properly before capturing them with Printer Migration Tool.Some of the other methods, vbs or printui, you could set these in the command and have a category for Printers with an item corresponding to each printer name, then call those options from the wpi menu...which requires you to know where the drivers are located.
silver74 Posted September 20, 2006 Author Posted September 20, 2006 I have tested these option,but the probleme is.When you install thise these options no be be gone on as default .So you have two printers with the same configuration.So i will find in what this configuration is storage.Reg,cfg,inf i dont find it.Can you tell me that?
leozack Posted November 12, 2010 Posted November 12, 2010 (edited) Iceman <3 I want your babies hahaha I think using your last option for installing IP ports/drivers/printers I finally have something that works to install stupid HP CLJ 2600n to a load of workstations who can't print via the server anymore because HP won't support that printer on server 2008 x64 and say it's because it's a host based printer (worked fine shared udner 2003 x86!)Time to test it all outOh yes - if there was a way to wrap this up so it was modular and could be called with the ip/name/driverpath for each printer, or at the start of the script it could call a function like that, so that I didn't have to use a seperate vbs for each one, it would be even more killer! Edited November 12, 2010 by leozack
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now