Click to See Complete Forum and Search --> : Specifying User Credentials
Emerald-64
January 19th, 2006, 08:32 AM
Hi this is my first thread! :)
I have used the "Run As" command to launch certain applications with different user credentials
I wanted to know is there any way of specifying these user credentials at the command prompt?
Stalemate
January 19th, 2006, 08:56 AM
Hi this is my first thread! :)
I have used the "Run As" command to launch certain applications with different user credentials
I wanted to know is there any way of specifying these user credentials at the command prompt?
Could it be done through the launching of the actual command prompt itself with said credentials?
And welcome to WD, Emerald-64. :)
Emerald-64
January 19th, 2006, 09:09 AM
Thanks stalemate :)
In short, No. In detail:
I have written a program in visual basic which executes commands in dos sequentially
Each command is simmilar and needs to be executed under different credentials. The point in creating the application was that it runs the dos application not the other way round.
I have been using the dos line:
runas user:USERNAME <App path>
the problem with this is that you are prompted for the password of the user and when you need to do this lots of users it gets boring, not to mention you get a ton of cmd.exe windows on your screen one for each user :rolleyes:
Stalemate
January 19th, 2006, 09:11 AM
I see.
Thanks for the details. You' right, that won't work at all.
But the RUNAS.EXE command from the command prompt can still help you out. ;)
Type it from a command prompt to get all the switches and paramaters and you're set. I think you'll need to use a text file to feed your parameters into the actual command line using the "/env" option.
Emerald-64
January 19th, 2006, 09:20 AM
Thanks :)
but still got the same problem that app doesn't let you specify the password thanks anyway. :)
I have tried using Batch scripts and Cmd Scripts and the prompt still breaks for the password.
Oh and the /env option isn't helping at all, if anything complicating things i think i'll leave that out
Stalemate
January 19th, 2006, 09:21 AM
Bummer...
Let me think about that one while I get a second cup of coffee. ;)
CeeBee
January 19th, 2006, 09:49 AM
What you need is either Kixtart (http://www.kixtart.org) or, even better, PSEXEC (part of PSTOOLS, http://www.sysinternals.com). Depends very much on whether the user running the app should be able to see the credentials or not. Kixtart will "spit" the keystrokes into the script (hidden) while psexec accepts the password as a command line argument. The disadvantage of Kixtart is that if the user has CAPS LOCK on, the logon will fail as the keystrokes will be sent in upper case.
CeeBee
January 19th, 2006, 09:54 AM
One more thing, be aware that in either case the user might have the possibility of editing the script and the passwords are in clear text... So if security is a concern, think of writing a small app that has the passwords in a scrambled format and de-scrambles them when launching the script. Still not perfect, but better than nothing.
Stalemate
January 19th, 2006, 10:08 AM
Thanks for the input CeeBee.
Coffee not doing it this morning for me.
I was looking into similar solutions, like RunAs Professional (http://www.softaward.com/2346.html) and VBScripting (http://www.tek-tips.com/faqs.cfm?fid=2760), but if Kix is already in use for Emerald-64 perhaps that would be ideal.
Emerald-64
January 20th, 2006, 04:31 AM
Thanks All!
I got the app running using the shell send keys command with the help of WScript. Not perfect and still got flaws but it does the job
If the user is running more than one app it goes to the active app so you switch to word pad and the data comes up on screen instead of going to the command script
RunAs professional seems to saolve all of my problems so it clearly is possible, however you have to buy it and i don't fancy paying for something i am only going to use once (waste)