Jump to content

Add printer with RunAs


lansti
 Share

Recommended Posts

Hi, i'm trying to add a printer with RunAs credentials in a domain environment.
I'm loged on as a local user, and in the startupscript it says:

runas("administrator","domain","******",1,runwait("rundll32 printui.dll,PrintUIEntry /in /n" & "\\printserver\printername" & " /q"))

It will not connect to the domain, and therefor will not install printer.

 

Link to comment
Share on other sites

I have tried:

runas("administrator","domain","******",0,runwait("rundll32 printui.dll,PrintUIEntry /in /n" & "\\printserver\printername" & " /q"))
runas("administrator","domain","******",1,runwait("rundll32 printui.dll,PrintUIEntry /in /n" & "\\printserver\printername" & " /q"))
runas("administrator","domain","******",2,runwait("rundll32 printui.dll,PrintUIEntry /in /n" & "\\printserver\printername" & " /q"))

EDIT1:
0 - Interactive logon with no profile.
1 - Interactive logon with profile.
2 - Network credentials only.

EDIT2:

Yes, the secondary logon service is running, if i add the printer manually as the user i define in the code, it works.. but not with this code...

Edited by lansti
Link to comment
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
 Share

×
×
  • Create New...