Sign in to follow this  
Followers 0
Adam Burgess

Trapping A Bad Login

6 posts in this topic

#1 ·  Posted (edited)

Hi

I'm just trying to create a quick installer to install an app I need to rollout. What I want to do is to is use the RunAsSet Function and if the password is correct the go through and install the app otherwise exit the installer if it's incorrect. Below is a copy of what I have done. If the code looks messy it is because it's my first attempt with this so any help would be appreciated.

Regards

Adam Burgess

$sAdminPwd = InputBox("Password", "Please enter the Admistrator Password", "", "*")

RunAsSet("Admistrator ", "MyDomain", $sAdminPwd)

;Check if the password is correct

if @error = 0 Then

MsgBox(64, "Login", "Administrator has logged in successfully")

Else

MsgBox(64, "Error", "There is an error with your login. Try again later")

EndIf

Edited by Adam Burgess

Share this post


Link to post
Share on other sites



I don't play with RunAsSet ever, but a few questions:

1. What OS are you trying to use this on?

2. I am going to assume since you have a Var for your AdminPassword, that your Domain is not really named "MyDomain"?

3. Your @error doesn't seem to be supported with RunAsSet():

Success: Returns 1--regardless of success. (If the login information was invalid, subsequent Run/RunWait commands will fail....)

Failure: Returns 0 if the operating system does not support this function.

Those are Return values not error values.

I'll look around to see if I can find anything, but if not, MHz will be on soon, and he loves to play with these functions :think:


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

1. I'll be running it on XP SP2

2. That's correct

3. I don't know

This is probably (hopefully) a common and easy thing to do. I think I have been just looking at my code to closely and missing the obvious.

Cheers

Share this post


Link to post
Share on other sites

1. I'll be running it on XP SP2

2. That's correct

3. I don't know

This is probably (hopefully) a common and easy thing to do. I think I have been just looking at my code to closely and missing the obvious.

Cheers

Here, this thread looked promising, look at how he used Run() after RunAsSet(), you could do error handling after that I'm sure.

http://www.autoitscript.com/forum/index.ph...indpost&p=74878


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

JdeB made a script for trapping a bad login: Admin.au3 can be found on his page: http://www.autoitscript.com/fileman/users/jdeb/jdeb_autoit_stuff.htm

Share this post


Link to post
Share on other sites

There also apears to be a space after Administrator in your RunAsSet command... that might be causing an issue too.


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

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