lisa_lionheart has asked for the wisdom of the Perl Monks concerning the following question:
Hi All,
I've been using perl for test scripts for several years but have never run into a problem like this before. I'm hoping one of you monks can tell me if it's even possible before I spent a whole lot of time on it.
I'm trying to test a product by using the windows command "runas" to start the product in different user contexts. It's like a windows su. However the folks at MS have decided to make my life difficult. You can start a program as so...
c:\runas /user:winuser "program args"
and it will run program as if you are logged in as winuser. What they've done to make it difficult is that blank passwords may not be used with runas, and the program will not accept a password argument. Instead, as soon as you run this, you get a password prompt...
Enter the password for winuser:
So I'm kind of stumped by this. I've always just used system() and passed it an array containing the name of a program and a list of args. That's fine for the initial invocation of runas, but since it's a missile, there isn't any way to pass something else after the fact.
Interestingly MS did this deliberately to prevent people from doing just what I'm trying to do, except that I'm just trying to do it to test something...
It's a long shot but I was wondering if any of you smart folks could think of a way that a perl script could start runas and then provide a password after the prompt?
There is a windows function called CreateProcessWithLogonW() which looks like it could serve as the basis for a free standing executable that I could call from the scripts which in turn would spawn the application under test in different user contexts. I fear that might be a bit over my head though.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: interactive command session possible?
by BrowserUk (Patriarch) on Sep 14, 2011 at 08:42 UTC | |
by lisa_lionheart (Initiate) on Sep 15, 2011 at 01:06 UTC | |
by BrowserUk (Patriarch) on Sep 15, 2011 at 01:22 UTC | |
|
Re: interactive command session possible?
by DrHyde (Prior) on Sep 14, 2011 at 09:22 UTC | |
|
Re: interactive command session possible?
by thewebsi (Scribe) on Sep 14, 2011 at 04:51 UTC | |
|
Re: interactive command session possible?
by Marshall (Canon) on Sep 14, 2011 at 02:17 UTC |