dexter Posted February 15, 2010 Posted February 15, 2010 Hi ! As a part of my program, I need to temporarily disable password prompt on wakeup option and at the end, re enable it. It works fine in case of Xp. But in Windows 7, I get error like you dont have required permission. please guide me. I m using a power config command using _runDos.
Raven1 Posted February 15, 2010 Posted February 15, 2010 Check the help file for the #RequireAdmin function.
dexter Posted February 16, 2010 Author Posted February 16, 2010 Thanks Raven, that will solve my issue to an extent ... I found a cmd script that can be used to enable and disable password prompt in Windows 7 , but it needs to be run as an admin ( which is fine now with #RequireAdmin function) and is to be run in elevated cmd ... The normal _runDos runs in cmd, which havnt got privilege to make changes,the elevated cmd has to be launched from system32\cmd.exe; else when ever we just start from run, it runs from user directory with lesser privileges. I can use run to launch the cmd.exe file from system32, but how will I enter this - "powercfg -SETDCVALUEINDEX SCHEME_BALANCED SUB_NONE CONSOLELOCK 0" ? I dont want to use keystroke simulation, since there is no guarantee that the GUI will be at the top. P.S. Plz clarify if runDos runs scripts on windows 7 under normal cmd or the elevated cmd.
Richard Robertson Posted February 16, 2010 Posted February 16, 2010 (edited) RunDos() will run the prompt under whatever security token the script currently has. If your script is admin, programs it runs will be admin as well. Edited February 16, 2010 by Richard Robertson
dexter Posted February 17, 2010 Author Posted February 17, 2010 RunDos() will run the prompt under whatever security token the script currently has. If your script is admin, programs it runs will be admin as well.No brother, I have checked that. Yes, #requireadmin is making it run with admin privileges, but those commands can only be executed from elevated cmd, RunDos runs only the normal cmd. I can start elevated cmd using run via system32 directory. But how do I pass those commands ? And I dont want the cmd window to be visible to the user.
Richard Robertson Posted February 17, 2010 Posted February 17, 2010 (edited) Have you tried this? #RequireAdmin ;... RunWait("powercfg -SETDCVALUEINDEX SCHEME_BALANCED SUB_NONE CONSOLELOCK 0", "", @SW_HIDE) Edited February 17, 2010 by Richard Robertson
dexter Posted February 17, 2010 Author Posted February 17, 2010 Thanks a lot Richard, it worked just fine ... Thanks a lot again, you made my day !
Twixxct Posted April 3, 2010 Posted April 3, 2010 Richard that works great --but how do i do the same -but not have to click on the OK yes button to approve to run as admin. I need this to run and stop my service without being there (actually i will be sleeping-i hope) I am looking to stop a service so i can back up the files then restart the same service after my back up. --my back up program can run a script before and after the back up. so all i need to do is create 2 compiled script to run one to start and one to stop. is there an continuation of your script above that will auto key troke the yes click? or another script that can run with admin privileges. thanks Rob
Richard Robertson Posted April 3, 2010 Posted April 3, 2010 No. If UAC is active, you must allow at least one program to run as admin by physically clicking the button.
Twixxct Posted April 3, 2010 Posted April 3, 2010 thanks then how can you click on the stop button in services window in windows and the service stops without asking? I would think we could do the same? rob
Twixxct Posted April 3, 2010 Posted April 3, 2010 (edited) with either admin user or administrator(windows) do youhave to have a password or can it be blank ( "" ), using Runas what do you use as domain if you are on a workgroup ("MSHOME"). do you replace DomainName with ComputerName if only local? Rob Edited April 3, 2010 by Twixxct
Richard Robertson Posted April 3, 2010 Posted April 3, 2010 Services are already running under the system account and have administrative access. You must be an administrator to set up the service in the first place.
TurionAltec Posted April 7, 2010 Posted April 7, 2010 You can use scheduled tasks to start an application as administrator without being prompted every time: http://www.howtogeek.com/howto/windows-vista/create-administrator-mode-shortcuts-without-uac-prompts-in-windows-vista/
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