RunAs using an HTA
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
RunAs using an HTA
Hello,I'm looking for some assistance with using an HTA form to launch another hta file as a Domain administrator. (domainusername) any ideas or maybe a best practice for this type of situation where an hta file needs admin rights to run?uploads/34385/runas.txtI don't think my attachment came through so I'm going to paste my code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- ... dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>TSM POST SETUP</title></head><script language="vbscript">Sub send_onclick()on error resume next sPSExec = "psexec /accepteula -u " & sUserID & " -p " & sUserPassword & " " & "" sCmd = sPSExec & "cscript.exe filestest4.hta" Set oShell = CreateObject("WScript.Shell") oShell.run sCmdend sub</script><body><body style="background-color: #EF0000"> Type you AX Account<br /> <Input type=text name="sUserID" tabindex=1 size="20"><br> Type your Password (AX Account) <br /> <Input type=password name="sUserPassword" tabindex=1 size="20"> <br /> <br /><input name="Button1" type="button" value="Login" /></body></html>
RunAs using an HTA
Yes running as the admin works, however if another tech needs to run this they would have to edit the batch file and remove the name and add theirs. I'll try the above with an hta form and see if I'm able to do it using runas. last time I attempted it threw an error back saying that the hta file was an invalid win32 application. But when I used your runas line it worked with my credentials, I'll see what I can do with an HTA form.
RunAs using an HTA
THe following:
Works fine for me.
jvierra2010-09-08 14:33:15
Code: Select all
WshShell.Exec "RunAs /u:" & user & " & " ""cmd /c c:testmyhta.hta"""
jvierra2010-09-08 14:33:15
RunAs using an HTA
yes that worked! This will work just fine for what I'm doing here. Thanks again for your help!