tlman12 Posted April 16, 2009 Share Posted April 16, 2009 (edited) This is a very simple script but at the same time pretty useful all it does is sit take your computer credentials and sits waiting in the background for the runas box to pop up and automatically types your information for you. like i said simple but if your a system admin and you do a lot of work on user computer environments you may use the RunAs a lot. I know i personally use the RunAs feature atleast 5 or 6 times and having to type in my credentials everytime is a PITA anyways here it is. It has the option to hard code the user information but this is not really recommended, especially if for some reason you forget to delete it from the users computer when your done expandcollapse popupLocal $user = "" local $pass = "" Local $domain = "" If $user = "" Then $user = InputBox("Username", "Please enter the username you would like to use") If $user = "" Then Exit EndIf EndIf If $pass = "" Then $pass = InputBox("Password", 'Please enter the password for "' & $user & '"',"","*") If $pass = "" Then Exit EndIf EndIf If $domain = "" Then $domain = InputBox("Domain", 'Please enter the domain for "' & $user & '"') If $domain = "" Then $domain = @ComputerName EndIf EndIf If @OSVersion = "WIN_XP" Then While 1 $pos1 = MouseGetPos(0) $pos2 = MouseGetPos(0) If $pos1 <= "10" And $pos2 <= "10" Then MsgBox(0, "Done", "Mouse detected at " & MouseGetPos(0) & "," & MouseGetPos(1) & " the script will now exit.") Exit EndIf If WinActive("Run As", "") Then Send("f") Send($domain & "\" & $user) Send("{TAB}") Send($pass) Send("{ENTER}") EndIf Sleep(500) WEnd ElseIf @OSVersion = "WIN_2000" Then While 1 $pos1 = MouseGetPos(0) $pos2 = MouseGetPos(0) If $pos1 <= "10" And $pos2 <= "10" Then MsgBox(0, "Done", "Mouse detected at " & MouseGetPos(0) & "," & MouseGetPos(1) & " the script will now exit.") Exit EndIf If WinActive("Run As Other User", "") Then Send("f") Send("{TAB}") Send($user) Send("{TAB}") Send($pass) Send("{TAB}") Send($domain) Send("{ENTER}") EndIf WEnd Sleep(500) Else MsgBox(16, "Error...", "Error, the operating system you are using is not supported by this script.") EndIfRunAsAuto.exe Edited April 16, 2009 by tlman12 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now