Untested (I'm away from my PC), but provides the general idea:
my $User="Somebody";
my $Pass="ThisIsInsecure!";
my $Program_to_run="notepad.exe";
my $result=`echo $Pass|RunAs /User:$User $Program_to_run`;
If the command prompt is not invoked correctly, you may need to add a "cmd/c " before the "echo".
Theory is when you know something, but it doesn't work. Practice is when
something works, but you don't know why it works. Programmers combine Theory
and Practice: Nothing works and they don't know why.
-Anonymous
| [reply] [d/l] |
| [reply] |
Hi,
Thanks for the reply. I am afraid I have to grovel a bit as I am new to Perl and would not have much of an idea of how to best use the modules you mention. Is is possible you could supply an exmple of how they could be used to invoke the runas command.That would be really appreciated,
| [reply] |
Hi,
Thanks for the suggestion. Gave it a try but basically its the same as things I have tried to do with echo and redirection.It seesms its not possible do do this with Runas. As I mentioned I had considered the React or Expect modules to respond to the password prompt but could not find workable modules for Windows.
| [reply] |