2

Im trying to install in a remote server, updates approved in our Wsus:

$session=New-PSSession -ComputerName server1
    Invoke-Command -Session $session -ScriptBlock {
    (Import-module -name "S:\temp\PSWindowsUpdate" -Verbose),
    (Get-WindowsUpdate | Format-Table -Verbose)
    Enable-WURemoting
    (Install-module pswindowsupdate -force -Accept -SkipPublisherCheck -AllowClobber),
    (Get-WUInstall -AcceptAll -AutoReboot -Verbose)}

But i get this access denied error:

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) + CategoryInfo : NotSpecified: (:) [Get-WindowsUpdate], UnauthorizedAccessException + FullyQualifiedErrorId : System.UnauthorizedAccessException,PSWindowsUpdate.GetWindowsUpdate + PSComputerName : server1

I am administrator of the remote server.

Its not possible launch de updates installation on remote servers?

Thanks,

RAN55
  • 63

1 Answers1

3

You can't install updates on a computer from a remote session. here's a list what you can and can't do using WUA from a remote computer.

Since you use PSWindowsUpdate you can use Invoke-WUJob which creates and runs a scheduled task on the remote computer, working around the WUA limitation. e.g:

invoke-WUJob -ComputerName MyComputer -Script { Install-WindowsUpdate -AcceptAll -SendReport -IgnoreReboot } -Confirm:$false -verbose -RunNow

There are other ways to work around this, however i find this the easiest.

SimonS
  • 9,869