From: leopete on
Hello all,
Im having problems with the following script. I get a
error:generic failure
line:37 (which is the last line of the script)
char:2
code: 80041001
Im using this script in active directory group policy in machine startup
script

group policiesstrComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set objDriver = objWMIService.Get("Win32_PrinterDriver")
objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True

objDriver.Name = "HP Color LaserJet 4600 PCL6"
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3"
errResult = objDriver.AddPrinterDriver(objDriver)


Set objNewPort = objWMIService.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_

objNewPort.Name = "IP_10.10.96.17"
objNewPort.Protocol = 1
objNewPort.HostAddress = "10.10.96.17"
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_



Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_


objPrinter.DriverName = "HP Color LaserJet 4600 PCL6"
objPrinter.PortName = "IP_10.10.96.17"
objPrinter.DeviceID = "HP Color LaserJet 4600 PCL6"
objPrinter.Location = "Room Color"
objPrinter.Network = True
objPrinter.Shared = False
objPrinter.ShareName = "HP Color LaserJet 4600 PCL6"
objPrinter.Put_




--
The only easy day was Yesterday
From: TDM on

Using the WMI Object Browser, I saw no DeviceID property(WinXPPro/SP2).
Maybe try removing it.

TDM

"leopete" <leopete(a)discussions.microsoft.com> wrote in message
news:2C53BDE5-D855-4BAF-B235-560F1FAE0F7A(a)microsoft.com...
> Hello all,
> Im having problems with the following script. I get a
> error:generic failure
> line:37 (which is the last line of the script)
> char:2
> code: 80041001
> Im using this script in active directory group policy in machine startup
> script
>
> group policiesstrComputer = "."
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
>
> Set objDriver = objWMIService.Get("Win32_PrinterDriver")
> objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege",
> True
>
> objDriver.Name = "HP Color LaserJet 4600 PCL6"
> objDriver.SupportedPlatform = "Windows NT x86"
> objDriver.Version = "3"
> errResult = objDriver.AddPrinterDriver(objDriver)
>
>
> Set objNewPort = objWMIService.Get _
> ("Win32_TCPIPPrinterPort").SpawnInstance_
>
> objNewPort.Name = "IP_10.10.96.17"
> objNewPort.Protocol = 1
> objNewPort.HostAddress = "10.10.96.17"
> objNewPort.PortNumber = "9100"
> objNewPort.SNMPEnabled = False
> objNewPort.Put_
>
>
>
> Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
>
>
> objPrinter.DriverName = "HP Color LaserJet 4600 PCL6"
> objPrinter.PortName = "IP_10.10.96.17"
> objPrinter.DeviceID = "HP Color LaserJet 4600 PCL6"
> objPrinter.Location = "Room Color"
> objPrinter.Network = True
> objPrinter.Shared = False
> objPrinter.ShareName = "HP Color LaserJet 4600 PCL6"
> objPrinter.Put_
>
>
>
>
> --
> The only easy day was Yesterday


From: TDM on

Sorry, forget my last post, got confused in the alphabetical list, DeviceID
does exist.

TDM

"leopete" <leopete(a)discussions.microsoft.com> wrote in message
news:2C53BDE5-D855-4BAF-B235-560F1FAE0F7A(a)microsoft.com...
> Hello all,
> Im having problems with the following script. I get a
> error:generic failure
> line:37 (which is the last line of the script)
> char:2
> code: 80041001
> Im using this script in active directory group policy in machine startup
> script
>
> group policiesstrComputer = "."
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
>
> Set objDriver = objWMIService.Get("Win32_PrinterDriver")
> objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege",
> True
>
> objDriver.Name = "HP Color LaserJet 4600 PCL6"
> objDriver.SupportedPlatform = "Windows NT x86"
> objDriver.Version = "3"
> errResult = objDriver.AddPrinterDriver(objDriver)
>
>
> Set objNewPort = objWMIService.Get _
> ("Win32_TCPIPPrinterPort").SpawnInstance_
>
> objNewPort.Name = "IP_10.10.96.17"
> objNewPort.Protocol = 1
> objNewPort.HostAddress = "10.10.96.17"
> objNewPort.PortNumber = "9100"
> objNewPort.SNMPEnabled = False
> objNewPort.Put_
>
>
>
> Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
>
>
> objPrinter.DriverName = "HP Color LaserJet 4600 PCL6"
> objPrinter.PortName = "IP_10.10.96.17"
> objPrinter.DeviceID = "HP Color LaserJet 4600 PCL6"
> objPrinter.Location = "Room Color"
> objPrinter.Network = True
> objPrinter.Shared = False
> objPrinter.ShareName = "HP Color LaserJet 4600 PCL6"
> objPrinter.Put_
>
>
>
>
> --
> The only easy day was Yesterday


From: TDM on

Well, once I changed all references to "HP Color LaserJet 4600 PCL6" to a
printer
that actually existed in the list, your script worked fine for me. On my
system(XPPro/SP2),
there was no "HP Color LaserJet 4600 PCL6" driver listed.

For what its worth ...

TDM

"leopete" <leopete(a)discussions.microsoft.com> wrote in message
news:2C53BDE5-D855-4BAF-B235-560F1FAE0F7A(a)microsoft.com...
> Hello all,
> Im having problems with the following script. I get a
> error:generic failure
> line:37 (which is the last line of the script)
> char:2
> code: 80041001
> Im using this script in active directory group policy in machine startup
> script
>
> group policiesstrComputer = "."
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
>
> Set objDriver = objWMIService.Get("Win32_PrinterDriver")
> objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege",
> True
>
> objDriver.Name = "HP Color LaserJet 4600 PCL6"
> objDriver.SupportedPlatform = "Windows NT x86"
> objDriver.Version = "3"
> errResult = objDriver.AddPrinterDriver(objDriver)
>
>
> Set objNewPort = objWMIService.Get _
> ("Win32_TCPIPPrinterPort").SpawnInstance_
>
> objNewPort.Name = "IP_10.10.96.17"
> objNewPort.Protocol = 1
> objNewPort.HostAddress = "10.10.96.17"
> objNewPort.PortNumber = "9100"
> objNewPort.SNMPEnabled = False
> objNewPort.Put_
>
>
>
> Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
>
>
> objPrinter.DriverName = "HP Color LaserJet 4600 PCL6"
> objPrinter.PortName = "IP_10.10.96.17"
> objPrinter.DeviceID = "HP Color LaserJet 4600 PCL6"
> objPrinter.Location = "Room Color"
> objPrinter.Network = True
> objPrinter.Shared = False
> objPrinter.ShareName = "HP Color LaserJet 4600 PCL6"
> objPrinter.Put_
>
>
>
>
> --
> The only easy day was Yesterday