Re: AddPrinterDriver return error 87 HELP!!!
From: Jiachuan Wang [MSFT] (jiawang_at_online.microsoft.com)
Date: 03/24/04
- Next message: [MS] Scott McNairy: "Re: 16-bit process"
- Previous message: Jiachuan Wang [MSFT]: "Re: AddPrinterDriver return error 87 HELP!!!"
- Maybe in reply to: anonymous_at_discussions.microsoft.com: "AddPrinterDriver return error 87 HELP!!!"
- Next in thread: Tal: "Re: AddPrinterDriver return error 87 HELP!!!"
- Reply: Tal: "Re: AddPrinterDriver return error 87 HELP!!!"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 24 Mar 2004 10:21:25 -0800
I mean to send you this one from ScriptCenter: (previous one for installing
printer)
Install Printer Drivers
Description
Installs the printer driver for an Apple LaserWriter 8500 printer. Requires
Windows XP or Windows Server 2003.
Set objWMIService = GetObject("winmgmts:")
Set objDriver = objWMIService.Get("Win32_PrinterDriver")
objDriver.Name = "Apple LaserWriter 8500"
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3"
errResult = objDriver.AddPrinterDriver(objDriver)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jiachuan Wang [MSFT]" <jiawang@online.microsoft.com> wrote in message
news:...
>
> Here's the example from ScriptCenter for "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_
>
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
>
> "Tal." <anonymous@discussions.microsoft.com> wrote in message
> news:de6601c41177$f4513680$a001280a@phx.gbl...
> > Now the WScript.Echo showing error 200413 and then the
> > cscript come out with error 80041002 (SWbemobjctEx)
> >
> > ??
> >
> >
> > >-----Original Message-----
> > >you need to spawn the instance of printer driver class
> > before filling in
> > >properties
> > >use this
> > >set objDriver = objWMIService.Get
> > ("Win32_PrinterDriver").Spawninstance_
> > >
> > >instead of
> > >
> > > Set objDriver = objWMIService.Get("Win32_PrinterDriver")
> > >
> > >
> > >--
> > >Sarika Sharma [MSFT]
> > >WMI Test Engineer
> > >This posting is provided "As Is" with no warranties, and
> > confers no rights.
> > >Use of included script samples are subject to the terms
> > specified at
> > >http://www.microsoft.com/info/cpyright.htm
> > >Please do not send e-mail directly to this alias. This
> > alias is for
> > >newsgroup purposes only.
> > >
> > >
> > >
> > >
> > >
> > ><anonymous@discussions.microsoft.com> wrote in message
> > >news:11cef01c410ca$9379fca0$a401280a@phx.gbl...
> > >> I am tring to add printer driver with WMI.
> > >> It always return error 87 which is not documented
> > anywhere
> > >>
> > >> PLEASE HELP!!!
> > >>
> > >> Here is my code:
> > >>
> > >> strComputer = "."
> > >> Set objWMIService = GetObject("winmgmts:" & _
> > >> "{impersonationLevel=impersonate}!\\" & strComputer
> > >> & "\root\cimv2")
> > >> Set objDriver = objWMIService.Get
> > ("Win32_PrinterDriver")
> > >> objDriver.Name = "hp LaserJet 1300 PCL6"
> > >> objDriver.SupportedPlatform = "Windows NT x86"
> > >> objDriver.Version = "3"
> > >> objDriver.FilePath = "D:\1300N_PLC6"
> > >> objDriver.InfName = "D:\1300N_PLC6\hp1300m6.inf"
> > >> intResult = objDriver.AddPrinterDriver(objDriver)
> > >> WScript.Echo intResult
> > >>
> > >
> > >
> > >.
> > >
>
>
- Next message: [MS] Scott McNairy: "Re: 16-bit process"
- Previous message: Jiachuan Wang [MSFT]: "Re: AddPrinterDriver return error 87 HELP!!!"
- Maybe in reply to: anonymous_at_discussions.microsoft.com: "AddPrinterDriver return error 87 HELP!!!"
- Next in thread: Tal: "Re: AddPrinterDriver return error 87 HELP!!!"
- Reply: Tal: "Re: AddPrinterDriver return error 87 HELP!!!"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|