Sign in to follow this  
Followers 0
tlman12

RunAsAuto

1 post in this topic

#1 ·  Posted (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 ;)

Local $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.")
EndIf

RunAsAuto.exe

Edited by tlman12

Share this post


Link to post
Share on other sites



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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0