Jump to content
Sign in to follow this  
hesautoit

problem with runasset for adding printers.

Recommended Posts

hesautoit

hi, im new to autoit. pls kindly help me.

i cant add printers using runasset

Error message as below

Error: Line -1

Error : Unable to execute the external program.

The directory name is invalid.

CODE
DriveMapAdd("R:", "\\server\folder", 8)

RunAsSet("administrator", @ComputerName, "password")

Runwait("rundll32 shell32.dll,SHHelpShortcuts_RunDLL AddPrinter")

;Run("rundll32.exe printui.dll,PrintUIEntry /il", @SystemDir)

RunAsSet()

WinWaitActive("Add Printer Wizard")

Send("!n")

WinWaitActive("Add Printer Wizard")

Send("!l")

Send("!n")

WinWaitActive("Add Printer Wizard")

Send("!c")

Send("l")

Send("!n")

WinWaitActive("Port Name")

Send("\\printserver\HR 3005pcl")

Send("{TAB}")

Send("{ENTER}")

WinWaitActive("Add Printer Wizard")

Send("!h")

WinWaitActive("Install From Disk")

Send("\\server\folder\Printer_Driver\HP3005\Win32_2000_XP_S2003\PCL6")

Send("{ENTER}")

WinWaitActive("Add Printer Wizard")

Send("!n")

WinWaitActive("Add Printer Wizard")

Send("HR 3005PCL")

Send("!n")

WinWaitActive("Add Printer Wizard")

Send("!n")

WinWaitActive("Add Printer Wizard")

Send("!n")

WinWaitActive("Add Printer Wizard")

Send("!o")

Send("!n")

WinWaitActive("Add Printer Wizard")

Send("{ENTER}")

if i try this code, when asking for port name, there is an error.

using systemDir cannot add network ports?

CODE
DriveMapAdd("R:", "\\server\folder", 8)

RunAsSet("administrator", @ComputerName, "password")

;Runwait("rundll32 shell32.dll,SHHelpShortcuts_RunDLL AddPrinter")

Run("rundll32.exe printui.dll,PrintUIEntry /il", @SystemDir)

RunAsSet()

WinWaitActive("Add Printer Wizard")

Send("!n")

WinWaitActive("Add Printer Wizard")

Send("!l")

Send("!n")

WinWaitActive("Add Printer Wizard")

Send("!c")

Send("l")

Send("!n")

WinWaitActive("Port Name")

Send("\\printserver\HR 3005pcl")

Send("{TAB}")

Send("{ENTER}")

WinWaitActive("Add Printer Wizard")

Send("!h")

WinWaitActive("Install From Disk")

Send("\\server\folder\Printer_Driver\HP3005\Win32_2000_XP_S2003\PCL6")

Send("{ENTER}")

WinWaitActive("Add Printer Wizard")

Send("!n")

WinWaitActive("Add Printer Wizard")

Send("HR 3005PCL")

Send("!n")

WinWaitActive("Add Printer Wizard")

Send("!n")

WinWaitActive("Add Printer Wizard")

Send("!n")

WinWaitActive("Add Printer Wizard")

Send("!o")

Send("!n")

WinWaitActive("Add Printer Wizard")

Send("{ENTER}")

Share this post


Link to post
Share on other sites
JerryD

In the first case, I suspect the local Administrator account doesn't have access to the share.

Not sure what's happening in the second case.

Share this post


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
Sign in to follow this  

×