Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Execute an elevated script in a non interactive mode

$
0
0

Hello,

I'm trying to execute a powershell script to install some Updates for Windows. But when I execute it in a non interactive mode, I have this message : "To perform some operations you must run an elevated Windows
PowerShell console."

Her my script

#Add module PSWindowsUpdate
    Import-Module -Name X:\Prod\Windows\PowerShell\Modules\PSWindowsUpdate -Force -Global
# Install update
    Get-WUInstall -AcceptAll -IgnoreReboot -IgnoreUserInput -NotTitle "Internet Explorer" -WindowsUpdate  | Out-File C:\temp\PSWindowsUpdate.log

When I execute the script in interactive mode it's ok.

How can I elevate the PS execution in non interactive mode ?

Thanks for all your responses.

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles