Sign in to follow this  
Followers 0
Zlow

cross checking AD user and pass

3 posts in this topic

I've spent almost 2 hours searching now but haven't found anything remotely useful. I'm trying to authenticate the user/pass provided by a user. The problem I'm having is not getting errors when using the RunAs function.

Func SwitchUser($User,$Domain,$Pass)
    ProcessClose("Explorer.exe")
    ProcessWaitClose("Explorer.exe",10000)
    If ProcessExists("Explorer.exe") Then
        MsgBox(1,"","Explorer failed to close. Exiting Script.")
        Exit
    Else
        RunAs($User,$Domain,$Pass,0,"explorer.exe")
        ProcessWait("Explorer.exe",10000)
    EndIf
EndFunc

This portion of the script works perfectly unless an invalid username, domain, and/or password are passed to the function. If that is the case, explorer is indeed closed but then ran under the currently logged in user credentials. I need to verify the username and password are correct before passing them to this function.

--background--

For anyone curious, I'm doing this because we frequently have to change program settings or control panel options at the users desktop. Previous to IE7 we could simply right click IE, choose run as, authenticate with our domain admin credentials, use the IE address bar to navigate as needed. However starting with IE7, this does not work. I have to promote the user to admin, log out, log in, make the changes, remove admin rights, and log out/in again. I've found that I can kill explorer and run it with my credentials to get the access I need, make my changes, then kill explorer and run it as the user again. I'm writing this script to do just that, faster.

any help?

/Zlow

Share this post


Link to post
Share on other sites



I need to verify the username and password are correct before passing them to this function.

You answered your own question there. Run something and see if it works before killing Explorer.

How about this?

RunAs($User, $Domain, $Pass, 0, "control.exe inetcpl.cpl")

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

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