Jump to content

Run as admin in Windows 7


dexter
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
Share on other sites

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 by Twixxct
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...