Doesn't run the last invoke command. This is the error message I receive:
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))+ CategoryInfo : NotSpecified: (:) [Get-WindowsUpdate], UnauthorizedAccessException+ FullyQualifiedErrorId : System.UnauthorizedAccessException,PSWindowsUpdate.GetWindowsUpdate+ PSComputerName : 10.10.10.10
Is there something I can do/modify to get the last command to run on the remote machine without running into a permission issue?
$session = New-PSSession -ComputerName 10.10.10.10 -Credential $cred -Verbose
Start-Sleep -s 3
Invoke-Command -Session $session {Set-Service wuauserv -StartupType Manual -Verbose}
Start-Sleep -s 3
Invoke-Command -Session $session {Start-Service wuauserv -Verbose}
Start-Sleep -s 5
Invoke-Command -Session $session {Get-Service wuauserv | Select-Object -Property Name, StartType, Status -Verbose}
Start-Sleep -s 5
Invoke-Command -Session $session {Get-WindowsUpdate -AcceptAll -IgnoreReboot -Install -Verbose | Out-File C:\Windows\PSWindowsUpdate.log}
User contributions licensed under CC BY-SA 3.0