Jump to content
Sign in to follow this  
Adam Burgess

Trapping A Bad Login

Recommended Posts

Adam Burgess

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
SmOke_N

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:


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.

Share this post


Link to post
Share on other sites
Adam Burgess

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
SmOke_N

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


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.

Share this post


Link to post
Share on other sites
Geert

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
SpookMeister

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.