Jump to content

Login Script Help using AUTOIT


Recommended Posts

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

Link to post
Share on other sites
  • 4 weeks later...

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.
Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...