polo
polo

Reputation: 385

Trying to run Get-WindowsUpdate on a remote computer but get: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

I've got a powershell script to remote into other computers to get and install windows updates.

I'm logged into the admin account on my local machine. The script starts a powershell remote session into another computer which works fine.

Then once in the remote session the script should run:

Get-WindowsUpdate -AcceptAll -Install -AutoReboot

but i get this error:

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

I tried suggested solutions of changing the WMI permissions and I allowed this in the firewall settings but it still did not work.

Upvotes: 2

Views: 7181

Answers (1)

I have successfully scripted it by using:

Get-WindowsUpdate -verbose -computer $RemoteServer -AcceptAll -Install -AutoReboot

Upvotes: 0

Related Questions