I'm writing a client/server checking program but it needs to run as Administrator.
I want this to run silently on my network and users, and I don't want the "Run as" Administrator" prompt. Is there any beginning code that I can place into the batch file to make it auto-run as Administrator?
You can also open a command prompt using a run-box (Windows + R). To do so, open a run-box, write cmd , and press Control + Shift + Enter to open the command prompt as an administrator. Ace your System Design Interview and take your career to the next level.
No: The - create a shortcut [ -> Compatibility -> "run this program as an administrator" ] solution does not work.
This option is greyed out in Windows 7. Even with UAC disabled
No: The runas /env /user:domain\Administrator <program.exe/command you want to execute>
is also not sufficient because it will prompt the user for the admin password.
Yes: Disable UAC -> Create a job using task scheduler, this worked for me.
You can let the script enable UAC afterwards by editing the registry if you would want. In my case this script is ran only once by creation of a windows virtual machine, where UAC is disabled in the image.
Still looking forward for the best approach for a script run as admin without too much hassle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With