Running a script as administrator without login as administrator
Is the UAC enabled? You probably have to have you script elevate itself. This probably means that your script will display a UAC prompt.
This was the first search hit for 'powershell uac prompt'.
Related videos on Youtube
NAADEV
Updated on September 17, 2022Comments
-
NAADEV over 1 year
An old mate of mine used to say "Any question is stupid. Stupid is avoid asking"
I'm pretty new on Windows System Administrator (just 3/4 months) and recently i started working on powershell 2.0.
I'm administering a set of windows services, one of them is going to try to execute a "Start-Service" command as part of a powershell script. This windows service is running under a domain account "ATG\Boot" as part of administrators group.
But, Start-Service/Stop-Service always fails for this reason:
Stop-Service : Service 'SQL Server Reporting Services (MSSQLSERVER) (ReportServer)' cannot be stopped due to the follow ing error: Cannot open ReportServer service on computer '.'. At line:1 char:13 + Stop-Service <<<< Report + CategoryInfo : CloseError: (System.ServiceProcess.ServiceController:ServiceController) [Stop-Service],
ServiceCommandException + FullyQualifiedErrorId : CouldNotStopService,Microsoft.PowerShell.Commands.StopServiceCommandThis error is reproduced when i execute script from shell, but works properly when i run script with "Run as administrator" option.
I would like to empathize that user is part of local administrators group.
Any ideas?