TicTac09 Posted March 13, 2013 Share Posted March 13, 2013 (edited) 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 March 13, 2013 by TicTac09 Link to comment Share on other sites More sharing options...
PhoenixXL Posted March 13, 2013 Share Posted March 13, 2013 (edited) Check Run as System in my signature orelse you might just require #RequireAdmin#RequireAdmin MsgBox( 64, "Info", IsAdmin()) Edited March 13, 2013 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. Link to comment Share on other sites More sharing options...
TicTac09 Posted March 13, 2013 Author Share Posted March 13, 2013 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. Link to comment Share on other sites More sharing options...
PhoenixXL Posted March 13, 2013 Share Posted March 13, 2013 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. Link to comment Share on other sites More sharing options...
TicTac09 Posted March 13, 2013 Author Share Posted March 13, 2013 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 >_> ) Link to comment Share on other sites More sharing options...
PhoenixXL Posted March 13, 2013 Share Posted March 13, 2013 (edited) Two waysDisable the UACOrelse face the UAC prompt Edited March 13, 2013 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. Link to comment Share on other sites More sharing options...
iamtheky Posted March 13, 2013 Share Posted March 13, 2013 -or see if this works for your needs ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
PhoenixXL Posted March 13, 2013 Share Posted March 13, 2013 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. 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