Hold down both the Ctrl and the Shift keys on your keyboard and then click or tap on that program's shortcut. You can also use the "Ctrl + Shift + Click/Tap" shortcut on an app's Start Menu tile to run it with administrator permissions in Windows 10.
Right-click on your application or its shortcut, and then select Properties in the context menu. Under the Compatibility tab, check the “Run this program as an administrator” box and click OK. From now on, double-click on your application or shortcut and it should automatically run as administrator.
Open Start. Right-click the app (anywhere on the menu). Select the More submenu, and click the Run as administrator option.
Try this:
runas.exe /savecred /user:administrator "%sysdrive%\testScripts\testscript1.ps1"
It saves the password the first time and never asks again. Maybe when you change the administrator password you will be prompted again.
See this TechNet article: Runas command documentation
From a command prompt:
C:\> runas /user:<localmachinename>\administrator cmd
Or, if you're connected to a domain:
C:\> runas /user:<DomainName>\<AdministratorAccountName> cmd
It looks like psexec -h
is the way to do this:
-h If the target system is Windows Vista or higher, has the process
run with the account's elevated token, if available.
Which... doesn't seem to be listed in the online documentation in Sysinternals - PsExec.
But it works on my machine.
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