SU or RUNAS from a batch file

  • Thread starter Thread starter David
  • Start date Start date
D

David

Hi,

Can anybody help me out with a way to run either SU or
RUNAS from within a batch file or VBS so that it does not
prompt for a password?

Thanks in advance

David
 
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "runas.exe /env /user:DOMAINNAME\USERNAME
O:\pc_bin\installs\ASM\m730silent.exe"

WshShell.Sendkeys "PASSWORD FOR ABOVE"
WshShell.Sendkeys "~"
 
just don't use /savecred as that would allow end users to run any
application as Admin, as after all, you save the admin password for them.
 
David said:
Hi,

Can anybody help me out with a way to run either SU or
RUNAS from within a batch file or VBS so that it does not
prompt for a password?

for a batch file:
1. create a file with its only contents being the password and a CR/LF

2. runas /user:SU cmd.exe < pswd.txt
 
Matt Hickman said:
"David" <[email protected]> wrote in message

for a batch file:
1. create a file with its only contents being the password and a CR/LF

2. runas /user:SU cmd.exe < pswd.txt

I didn't think that the password was redirectible like that. My only problem
now is that I get error "1326: logon failure: unknown username or bad
password". Same command without the redirection worked, so I know I typed
the username correctly. Double-checked the password and tried with and
without crlf. Even used debug to verify it was crlf and not just lf.


/Al
 
Al Dunbar said:
I didn't think that the password was redirectible like that. My only problem
now is that I get error "1326: logon failure: unknown username or bad
password". Same command without the redirection worked, so I know I typed
the username correctly. Double-checked the password and tried with and
without crlf. Even used debug to verify it was crlf and not just lf.
My fault, I forgot runas will not accept redirection.
 
Back
Top