Mark Mears Posted January 4, 2006 Share Posted January 4, 2006 Hi all, We have remote users that require security patches. I have created a script that uses the RunAsSet function to run the patches in the context of the local Administrator account to be distributed to the users on a CD. This script is then compiled and run as an EXE file to ensure the password of this account is not compromised. While most of the users have a standardized password, some of the machines' admin accounts have not been updated to reflect the current password. Is there a way to check to see if the RunAsSet function has been successful in setting the credentials correctly? I have the following in my script: ******************* Opt("RunErrorsFatal", 0) $Username = "Administrator" $Password = "Passw0rd" ; Set the RunAs parameters to use local adminstrator account RunAsSet($Username, @Computername, $Password) If @Error = 1 Then SetError(0) MsgBox(4096, "Unknown Credentials", "Incorrect password supplied. Please notify the Help Desk.") Exit Endif ***************** My problem is that in testing this with a different password on the account, when I am expecting this to fail, I am unable to trap this condition and the script fails to produce any notification. Checking the @error macro in a MsgBox shows it at a 0 value. What I need is a way to check to see if the RunAsSet function was able to successfully set the credentials. If the credentials were not successfully set then I need to give the user a notification that they need to either run an alternate script or notify the Help Desk so the password can be reset. If the credentials are correct, the script runs fine! Any takers? Thanks in advance! Mark Link to comment Share on other sites More sharing options...
CyberSlug Posted January 4, 2006 Share Posted January 4, 2006 Maybe:http://www.autoitscript.com/forum/index.ph...729&hl=RunAsSet Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Mark Mears Posted January 4, 2006 Author Share Posted January 4, 2006 That works like I was hoping! Thanks! Mark Link to comment Share on other sites More sharing options...
ainner Posted January 4, 2006 Share Posted January 4, 2006 I have the same problem and checked the link and didn't find the solution... What exactly did you do in the end mark ? Thx Link to comment Share on other sites More sharing options...
ainner Posted January 4, 2006 Share Posted January 4, 2006 nevermind I got it Link to comment Share on other sites More sharing options...
Mark Mears Posted January 4, 2006 Author Share Posted January 4, 2006 Hey Ainner, Can you let me know what worked for you. I looked further into the docs and found the the solution I had tried actually did not work. The Opt() function return value is documented in the Help file as the value of the previous stored value. In my case, I started with the default value of 1 and reset the value to 0. When I assigned the variable to the return value of the function, it returned the previous value ("1") which appeared to work for me when I tried to test with an incorrect password. A correct password returned the same value which indicates to me that this is NOT the correct way to check for the correct password. Does anybody have a manner of verifying the RunAsSet credentials? Thanksm, Mark Link to comment Share on other sites More sharing options...
ainner Posted January 4, 2006 Share Posted January 4, 2006 AutoItSetOption ( "RunErrorsFatal", 0 )passwd = InputBox("Contrôle de sécurité", "Entrer un mot de passe : ", "", "*")RunAsSet("MSSSa", @Computername, $passwd) $pid=Run ( 'C:\Program Files\Internet Explorer\iexplore.exe c:\', 'C:\Program Files\Internet Explorer' ) If $pid = 0 Then MsgBox(4096,"Mot de passe invalide","Le mot de passe entré est invalide...") Exit EndIfHere's how I did it...You just need to check if the run program return the zero value... Hope it help... 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