ZEDA_ISG
asked on
Printer script
It is quite common that we have to install printers for our users on a daily basis.
All the printers are HP and have a IP address assigned to them.
Is it possible to create a script that you could run on an individuals machine that would install a particular printer with the correct IP?
The drivers are located on the server so the files could be taken from there. I understand that you would probably need a script for each model but this would save us a lot of time in the future.
Is it possible? Can anyone create a script for this?
Many thanks in advance.
All the printers are HP and have a IP address assigned to them.
Is it possible to create a script that you could run on an individuals machine that would install a particular printer with the correct IP?
The drivers are located on the server so the files could be taken from there. I understand that you would probably need a script for each model but this would save us a lot of time in the future.
Is it possible? Can anyone create a script for this?
Many thanks in advance.
ASKER
Thank you for the reply.
I was actually looking for a printer script that would assign the IP address of the printer, not a script where it looks for it on the servre, i.e.:
WSHNetwork.SetDefaultPrint er "\\ServerName\PrinterName"
End Select
The process I would like to be created by a script (if possible) is this process:
Add Printer > A local printer > Create New Port > Standard TCP/IP Port
The script will then assign the correcr IP for this printer and install the printer drivers
I was actually looking for a printer script that would assign the IP address of the printer, not a script where it looks for it on the servre, i.e.:
WSHNetwork.SetDefaultPrint
End Select
The process I would like to be created by a script (if possible) is this process:
Add Printer > A local printer > Create New Port > Standard TCP/IP Port
The script will then assign the correcr IP for this printer and install the printer drivers
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The above links didn't actually work but part of it was amended to make it work.
This may help someone else.
Here is the script I have got to work:
strComputer = "."
Set objWMIService = GetObject("winmgmts:{imper sonationLe vel=impers onate}!\\" & strComputer & "\root\cimv2")
set objNewPort = objWMIService.get("Win32_T CPIPPrinte rPort").Sp awnInstanc e_
Set objPrinter = objWMIService.Get("Win32_P rinter").S pawnInstan ce_
objWMIService.Security_.Pr ivileges.A ddAsString "SeLoadDriverPrivilege", True
Set objDriver = objWMIService.Get("Win32_P rinterDriv er")
objDriver.Name = "HP LaserJet 2100 Series PS"
objDriver.SupportedPlatfor m = "Windows NT x86"
objDriver.Version = "3"
objDriver.FilePath = "\\servername\drive\Driver s\PrintDri vers\HP\HP 2100TN PS"
objDriver.Infname = "\\servername\drive\Driver s\PrintDri vers\HP\HP 2100TN PS\HP2100PS.INF"
intResult = objDriver.AddPrinterDriver (objDriver )
'Installs Printer Port
objNewPort.Name = "PRINTERNAME"
objNewPort.Protocol = 1
objNewPort.HostAddress = "172.16.xx.xxx"
objNewPort.PortNumber = 9100
objNewPort.SNMPEnabled = True
objNewPort.Put_
'Install Printer
objPrinter.DriverName = "HP LaserJet 2100 Series PS"
objPrinter.PortName = "PRINTERNAME"
objPrinter.DeviceID = "PRINTERNAME"
objPrinter.Put_
This may help someone else.
Here is the script I have got to work:
strComputer = "."
Set objWMIService = GetObject("winmgmts:{imper
set objNewPort = objWMIService.get("Win32_T
Set objPrinter = objWMIService.Get("Win32_P
objWMIService.Security_.Pr
Set objDriver = objWMIService.Get("Win32_P
objDriver.Name = "HP LaserJet 2100 Series PS"
objDriver.SupportedPlatfor
objDriver.Version = "3"
objDriver.FilePath = "\\servername\drive\Driver
objDriver.Infname = "\\servername\drive\Driver
intResult = objDriver.AddPrinterDriver
'Installs Printer Port
objNewPort.Name = "PRINTERNAME"
objNewPort.Protocol = 1
objNewPort.HostAddress = "172.16.xx.xxx"
objNewPort.PortNumber = 9100
objNewPort.SNMPEnabled = True
objNewPort.Put_
'Install Printer
objPrinter.DriverName = "HP LaserJet 2100 Series PS"
objPrinter.PortName = "PRINTERNAME"
objPrinter.DeviceID = "PRINTERNAME"
objPrinter.Put_
I've found most scripts need some "tweaking" for an individual location/functionality. Glad I was able to refer you to some that were adaptable to your circumstances.
michko
michko
Hi there ZEDA_ISG
is the above script working for remote computers??
espacially this part that i'm intrested to know if it's working or not
objDriver.FilePath = "\\servername\drive\Driver s\PrintDri vers\HP\HP 2100TN PS"
objDriver.Infname = "\\servername\drive\Driver s\PrintDri vers\HP\HP 2100TN PS\HP2100PS.INF"
did that manage to install the printer driver on a remote computer?
is the above script working for remote computers??
espacially this part that i'm intrested to know if it's working or not
objDriver.FilePath = "\\servername\drive\Driver
objDriver.Infname = "\\servername\drive\Driver
did that manage to install the printer driver on a remote computer?
http://www.tek-tips.com/faqs.cfm?fid=5798
http://techrepublic.com.com/5208-6230-0.html?forumID=101&threadID=231944&start=0