hi ,
I have some trouble with script .
i don't understand where the problem is ....
if some one could help me , it will be awesome !.
strComputer = "PC_01"
'strDomain = "Workgroup"
strUser = "Workgroup\Administrator"
strPassword = "toto"
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer, "root\cimv2", strUser, strPassword)
Set objNewPort = objSWbemServices.Get("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = "IP_192.168.0.1"
objNewPort.Protocol = 1
objNewPort.HostAddress = "192.168.0.1"
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_
objSWbemServices.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True
Set objDriver = objSWbemServices.Get ("Win32_PrinterDriver")
objDriver.Name = "RICOH Aficio MP 2000 PCL 6"
'objDriver.FilePath = "\\Server01\D$\ricoh\disk1"
'objDriver.Infname = "\\Server01\D$\ricoh\disk1\OEMSETUP.INF"
objDriver.FilePath = "C:\ricoh0\disk1\"
objDriver.Infname = "C:\ricoh0\disk1\OEMSETUP.INF"
intResult = objDriver.AddPrinterDriver(objDriver)
Set objPrinter = objSWbemServices.Get("Win32_Printer").SpawnInstance_
objPrinter.DriverName = "RICOH Aficio MP 2000 PCL 6"
objPrinter.PortName = "IP_192.168.0.1"
objPrinter.DeviceID = "RICOH Aficio MP 2000 (192.168.0.1)"
objPrinter.Location = ""
objPrinter.Network = True
objPrinter.Shared = False
objPrinter.Put_
When i put the driver file on the remote machine "C:/" it's work fine , but when the driver file are on the server the result of my code is an error 87 .
Thank's for your Help .
I have some trouble with script .
i don't understand where the problem is ....
if some one could help me , it will be awesome !.
strComputer = "PC_01"
'strDomain = "Workgroup"
strUser = "Workgroup\Administrator"
strPassword = "toto"
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer, "root\cimv2", strUser, strPassword)
Set objNewPort = objSWbemServices.Get("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = "IP_192.168.0.1"
objNewPort.Protocol = 1
objNewPort.HostAddress = "192.168.0.1"
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_
objSWbemServices.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True
Set objDriver = objSWbemServices.Get ("Win32_PrinterDriver")
objDriver.Name = "RICOH Aficio MP 2000 PCL 6"
'objDriver.FilePath = "\\Server01\D$\ricoh\disk1"
'objDriver.Infname = "\\Server01\D$\ricoh\disk1\OEMSETUP.INF"
objDriver.FilePath = "C:\ricoh0\disk1\"
objDriver.Infname = "C:\ricoh0\disk1\OEMSETUP.INF"
intResult = objDriver.AddPrinterDriver(objDriver)
Set objPrinter = objSWbemServices.Get("Win32_Printer").SpawnInstance_
objPrinter.DriverName = "RICOH Aficio MP 2000 PCL 6"
objPrinter.PortName = "IP_192.168.0.1"
objPrinter.DeviceID = "RICOH Aficio MP 2000 (192.168.0.1)"
objPrinter.Location = ""
objPrinter.Network = True
objPrinter.Shared = False
objPrinter.Put_
When i put the driver file on the remote machine "C:/" it's work fine , but when the driver file are on the server the result of my code is an error 87 .
Thank's for your Help .