LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use SystemExec.vi for a RunAs command

I'm trying to use the SystemExec.vi in my application to open up an executable under a different user's login (for priveleges reasons).  Problem is that Windows has prevented embedding the password into the runas command line.  I don't want the techs running the program to have to enter, or even know the password.  How can I get around this so it performs the runas command with the password all behind the scenes?
0 Kudos
Message 1 of 4
(3,210 Views)
HI ejoseph,
 
Unfortunately the RunAs program in windows demands that you type the password manually.  From doing a quick search on the matter its believed this was was a conscious decision. If it were possible to pass the password on the command line, people would start embedding passwords into batch files and logon scripts, which is insecure.
In other words, the feature is missing to remove the temptation to use the feature insecurely.  However by looking at the help in Windows for the runas command it will prompt for a user password so if there was an account without a password you may be able to use the runas command without much extra effort.  There are other ways around this I noticed on the web that involved using existing applications already written.
 
Looking to help,
 
Steven B.
0 Kudos
Message 2 of 4
(3,186 Views)
Thank you for your help, but I have already solved the problem.  A friend of mine provided me with a .vbs script that allows me to work around the problem.  I now use wscript to call the .vbs, followed by my program and command line arguments.
0 Kudos
Message 3 of 4
(3,184 Views)

ejoseph,

Glad to hear it.  Most of the documents I read on the web pointed in that direction as well.  Happy coding for the rest of you application.

Regards,

Steve. B.

0 Kudos
Message 4 of 4
(3,179 Views)