loudguitar76 Posted August 10, 2005 Posted August 10, 2005 hello, I am trying to rewrite my VB login script completly in AUTOIT. I can map the drives using DriveMapAdd I can launch exe's using RunWait But how can i add printers? Like the below using VB script? strPrinterHost = "prlxhbgma01n003" strPrinterName = "PRLXHBGMA01N003" strPrinterDriver = "HP LaserJet 4000 Series PCL" Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Set objNewPort = objWMI.Get("Win32_TCPIPPrinterPort").SpawnInstance_ objNewPort.Name = "IP_" & strPrinterHost objNewPort.Protocol = 1 objNewPort.HostAddress = "prlxhbgma01n003" objNewPort.PortNumber = "9100" objNewPort.SNMPEnabled = False objNewPort.Put_ ' Add the printer objShell.Run "%windir%\system32\cscript.exe %windir%\system32\prnmngr.vbs -a -p """ & strPrinterName & """ -m """ & strPrinterDriver & """ -r IP_" & strPrinterHost, 0 , True Thanks Ben
iceberg Posted September 2, 2005 Posted September 2, 2005 hi, local printer or network printer? mouse not found....scroll any mouse to continue.
AutoChris Posted September 2, 2005 Posted September 2, 2005 hi,local printer or network printer?<{POST_SNAPBACK}>Based on his script, it looks to be a network printer. DriveMapAdd() would be ideal if it was a local printer, but unfortunately I am unsure of how to add a network printer via logon script. I use AutoIt for logon scripts too, but have not yet needed to add network printers with it.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now