General discussion

Locked

Installing Printer Drivers from CD

By plmaokaneng ·
Hello

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("WScript.shell")
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_

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


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

createPort "192.168.0.1", "192.168.0.1"


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

Set oShell = Nothing


rundll32 printui.dll, PrintUIEntry /if /f "C:\HPLJ 600\autorun.inf" /n "UPSTAIRS FTN-REV" /m "FTNRORML7" /r 192.168.0.1 /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

regards

This conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Back to Windows Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums