General discussion


Installing Printer Drivers from CD

By plmaokaneng ·

I would like to script a code that locates printer drivers from an external source not the pre-installed drivers. My code throws an error saying it cannot locate driver. I copied drivers from CD to a C: drive and put a line to reference .INF there. when it PC boots, it shows its connecting the printer but when i click on Devices and Printers tab, the printer is not installed, and no error.

The idea is to have a script that will run on a PC and connects every user to printer when he logs on to the said computer. I will then copy script to each machine on the building or will later create OU to add computers that can run it.

Right now please help me get pass the stage of locating drivers for printers. My printer is HP laser jet enterprise 600 m602.
Set WSHNetwork = WScript.CreateObject("WScript.Network")
set shell = WScript.CreateObject( "WScript.Shell" )
CompName = shell.ExpandEnvironmentStrings("%COMPUTERNAME%")
Set objWMIService = GetObject("winmgmts:\\" & CompName & "\root\cimv2")

Set objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_
Set oShell = WScript.CreateObject("")
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_

sub createPort (name, ip)
objNewPort.Name = FTNRORML7
objNewPort.Protocol = 1
objNewPort.HostAddress =
objNewPort.SNMPEnabled = False
end sub

'-- Call the create port function with the address and port name parameters

createPort "", "" "cmd /K rundll32 printui.dll,PrintUIEntry /if /f ""C:\HPLJ 600\autorun.inf"" /n ""UPSTAIRS FTN-REV"" /m ""FTNRORML7"" /r /b ""FTNRORML7"" /q"

Set oShell = Nothing

rundll32 printui.dll, PrintUIEntry /if /f "C:\HPLJ 600\autorun.inf" /n "UPSTAIRS FTN-REV" /m "FTNRORML7" /r /b "FTNRORML7"

as you can see i copied the drivers to C:\HPLJ 600 on the local machine trying to avoid admin issues over the network, coz my users hav admin right on the machines. its windows environment


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Related Discussions

Related Forums