Jump to content
Sign in to follow this  
TicTac09

Run As Admin (Self execution)

Recommended Posts

TicTac09

Hi there,

I'm trying to write a script for some users in my domain.

The script needs administrator rights, but i don't want to go to every pc and type the pw in manually.

So i tried something like this:

MsgBox(0, "Stop", "Stop?" & @LogonDomain)

If IsAdmin() Then
    MsgBox(0, "working", "working!")
Else
    RunAs("user", @LogonDomain, "PW", 2, @AutoItExe)
    If @error <> 0 Then MsgBox(16, "error - empty - ", "error code = "&@error)
EndIf

But the problem is, that the "IsAdmin" check is never true :/

Edited by TicTac09

Share this post


Link to post
Share on other sites
PhoenixXL

Check Run as System in my signature ;)

orelse you might just require #RequireAdmin

#RequireAdmin

MsgBox( 64, "Info", IsAdmin())
Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
TicTac09

Hi PhoenixXL!

Thanks for your answer

About your "RunAsSystem" Script:

It maybe sounds stupid, but does it work with a pc within a domain?

And #RequireAdmin won't work, 'cause he just promps the UAC-Window and asks for the credentials.

Share this post


Link to post
Share on other sites
PhoenixXL

RunAsSystem will make the script run under LSA account.

Hope you know what I mean. If thats your requirement it should work in a domain.

According to my guess #RequireAdmin should do what you want.

If UAC prompt is irritating you try to disable it using the Registry..!

Regards :)


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
TicTac09

No, that's the point - i don't want the UAC to promt

That's why i'm putting the credentials in the "RunAs" command.

Is there no way to get "arround" the UAC? - the account which i put in the "RunAs" command is a member of the Admin grp.

( Sorry for my bad english >_> )

Share this post


Link to post
Share on other sites
PhoenixXL

Two ways

  • Disable the UAC
  • Orelse face the UAC prompt
Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
iamtheky

-or see if this works for your needs


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
PhoenixXL

how did i miss that :|


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

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  

×