Hacker4All Posted March 25, 2009 Share Posted March 25, 2009 Okay, so, i just recently got AutoIt the other day, and i have been playing around with it since. Now, i have a Vista computer, and whenever i want to run something as administrator, a window pops up and all that. Is there someway to write a script that can run something as Administrator, and then click accept or just completly skip the whole UAC window pop- op? Here is what i have so far: $answer = MsgBox(4, "Password Changer", "If you would like to change the password, click Yes.") If $answer = 7 Then MsgBox(0, "Password Changer", "Okay, fine, keep things the way they are.") Exit EndIf Run("cmd.exe") WinWaitActive("C:\Windows\system32\cmd.exe") Send("net user owner *{enter}") Sleep(500) Send("password{enter}") Sleep(500) Send("password{enter}") The only problem with this is that it is running the cmd as an ordinary user, and not as an admin. Is there a script that will allow me to run files as administrator? Link to comment Share on other sites More sharing options...
TerarinK Posted March 25, 2009 Share Posted March 25, 2009 #RequireAdmin allows you to run as admin 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
Hacker4All Posted March 25, 2009 Author Share Posted March 25, 2009 #RequireAdmin allows you to run as adminSo, if i wanted to run cmd as admin, i would write in the script: #requireAdmin("cmd.exe") right? Link to comment Share on other sites More sharing options...
TerarinK Posted March 25, 2009 Share Posted March 25, 2009 You can also change the the UAC (User Account Control) true function, by going into secpol.msc and editting the local policies - security options. I have 10 options that I can change in there, it is the closest thing your get to having Windows 7 which has 9 function in the User Control alone. 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
TerarinK Posted March 25, 2009 Share Posted March 25, 2009 No you put #RequireAdmin at the top ofyour script and just run the script as if you ran it as a Admin 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
Hacker4All Posted March 25, 2009 Author Share Posted March 25, 2009 By doing this at the top of the screen, does that mean that after this is in there, it can run anything(double left click), and it would be the same as running it as and admin? Link to comment Share on other sites More sharing options...
SpookMeister Posted March 25, 2009 Share Posted March 25, 2009 I don't think #RequireAdmin is what you are looking for... it will not automatically give admin rights to the script, it just checks to see if you have the required rights, and prompts you accordingly if you don't.... or at least thats how I read it (I don't have Vista) [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] Link to comment Share on other sites More sharing options...
TerarinK Posted March 25, 2009 Share Posted March 25, 2009 Yes, but you will still have to confirm the box, but you are running it as a Admin 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
Hacker4All Posted March 25, 2009 Author Share Posted March 25, 2009 Oh okay. Here is what i am trying to create a script for just to see if i can do it(apparently i cannot, lol) In vista, in order to remotely change the password using the command prompt (cmd.exe), you have to run it as administrator. in order for you to do this, you have to right click, and say "run as administrator". doing this pops up the UAC window, and i am having trouble writing a script that will work with this window. It seems almost as though this window stops all background processes. Any way to get around this? Link to comment Share on other sites More sharing options...
TerarinK Posted March 25, 2009 Share Posted March 25, 2009 I don't think #RequireAdmin is what you are looking for... it will not automatically give admin rights to the script, it just checks to see if you have the required rights, and prompts you accordingly if you don't.... or at least thats how I read it (I don't have Vista)Depending on if the user is Admin already it will say your elevated permission are granted. However if you are a standard user you will get a box saying to put in the password of admin, this is the same thing as putting the commandline username and password. 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
TerarinK Posted March 25, 2009 Share Posted March 25, 2009 Then you need to turn off UAC in the User Account on Control Settings 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
Hacker4All Posted March 25, 2009 Author Share Posted March 25, 2009 Okay, in that link I read it the window that pops up is the second window. I cant get the script to work in that window though Link to comment Share on other sites More sharing options...
Hacker4All Posted March 25, 2009 Author Share Posted March 25, 2009 in the link i read it Link to comment Share on other sites More sharing options...
Hacker4All Posted March 25, 2009 Author Share Posted March 25, 2009 Nevermind, thank you for the help. Closed(if i have to close it i dont know how, lol) Link to comment Share on other sites More sharing options...
rajeshontheweb Posted March 26, 2009 Share Posted March 26, 2009 (edited) closed ??? have u got it sorted, mate?if sorted, can u post the final working code?if i gave up, pls dont do it already :-)1) <repeated> AutoIT on Vista2) disable / Turn off UAC on Vista3) most commonly used workaround for programs in vista using task scheduler 4) A Software to elevate selected programs in a container - seems to use above technology5) An Interesting article on how ireboot got out with a workaround!! Edited March 26, 2009 by rajeshontheweb Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet Link to comment Share on other sites More sharing options...
bo8ster Posted March 26, 2009 Share Posted March 26, 2009 I don't have Vista, but would not RunAs do the trick? Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] 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