Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Script to install a "HP 5Si Printer" as a local printer

4 views
Skip to first unread message

Tim

unread,
Aug 8, 2009, 6:26:01 PM8/8/09
to
OS: Windows XP

I have found scripts to install network printers, but
none to install local printers.

I would also like to have this printer setup to print to file.

Thanks for all comments.
--
Tim

Richard Mueller [MVP]

unread,
Aug 9, 2009, 11:27:32 AM8/9/09
to
Tim wrote:

> OS: Windows XP
>
> I have found scripts to install network printers, but
> none to install local printers.
>
> I would also like to have this printer setup to print to file.
>

One of these examples from the Script Center should help:

http://www.microsoft.com/technet/scriptcenter/scripts/printing/ports/prpovb04.mspx

http://www.microsoft.com/technet/scriptcenter/scripts/printing/ports/prpovb03.mspx

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


Tim

unread,
Aug 9, 2009, 12:27:01 PM8/9/09
to

Thanks for the reply.
I had already found this code and I couldn't get it to work.
errResult returns a 0

I can install ""HP LaserJet 5Si" manually without any problem.
I want to perform the install via automation.

Tim


Option Explicit

Call Main

Sub Main
Dim strComputer, objWMIService,objDriver, errResult
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set objDriver = objWMIService.Get("Win32_PrinterDriver")
objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True
'objDriver.Name = "Apple LaserWriter 8500"
objDriver.Name = "HP LaserJet 5Si"
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3"
errResult = objDriver.AddPrinterDriver(objDriver)
MsgBox errResult
End Sub

0 new messages