Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

VBScript input parameters

$
0
0

I am trying to run a script with a GPO that will install a printer, it's port and name and drivers etc.
How do I format the input parameters and pass them into this script, also any errors you see would be helpful to point out, thanks :)

'SETS 'LOAD DRIVER' PRIVILEGE.  
Set objWMIService = GetObject("Winmgmts:")
objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True
Set args = WScript.Arguments 
'SETS PRINTER PORT. 
Set objNewPort = objWMIService.Get _ 
("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = WScript.Arguments(0)
objNewPort.Protocol = 1
objNewPort.HostAddress = WScript.Arguments(1)
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_ 
 'SETS PRINTER TO PORT.  
Set objPrinter = objWMIService.Get _ 
("Win32_Printer").SpawnInstance_  
objPrinter.DriverName = WScript.Arguments(4)  
objPrinter.PortName   = WScript.Arguments(0)  
objPrinter.DeviceID   = WScript.Arguments(2)  
objPrinter.Location = "Front Office"  
objPrinter.Network = True  
objPrinter.Shared = False  
'objPrinter.ShareName =  
objPrinter.Put_ 


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>