I am trying to update a few PCs remotely by using Invoke-WUJob, for now I am just testing with 1 PC "UEA-Test2PC".
Here is my full commands ran from elevated powershell on both remote client PC and PC running the commands.
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted -Force
Install-Module PSWindowsUpdate
Import-Module PSWindowsUpdate
Add-WUServiceManager -MicrosoftUpdate
Enable-PSRemoting -Force
Get-Package -Name PSWindowsUpdate
winrm quickconfig
winrm set winrm/config/client '@{TrustedHosts="UEA-Test2PC, UEA-Test1PC"}'
I have put both IPs for the PCs in windows defender firewall (Windows Remote Management HTTP-In) Public for the local subnet.
I have setup a GPO for allow local port exceptions(Enabled) under network-->networkconnections-->windows defender firewall-->domain profile
and a GPO for WinRM Service for allow remote server management through WinRM(enabled) and Disallow Negotiate Authentication(Disabled). These GPOs were setup under computer policies, administrative templates at the domain level.
I have also verified these services are running:Remote Registry, WinRM.
Now, When I try to run any of these commands on the PC that will be forcing the update to a remote PC:
Invoke-WUJob -ComputerName UEA-Test2PC -Script {ipmo PSWindowsUpdate; Get-WindowsUpdate -Install -AcceptAll -AutoReboot} -RunNow -Confirm:$false -Verbose
Invoke-WUJob -ComputerName UEA-Test2PC -Script {ipmo PSWindowsUpdate; Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot} -RunNow -Confirm:$false -Verbose
Invoke-WUJob -ComputerName UEA-Test2PC -Script {ipmo PSWindowsUpdate; Get-WUJob -AcceptAll -AutoReboot} -RunNow -Confirm:$false -Verbose
It gives me this error still:
Invoke-WUJob : [UEA-Test2PC] Connecting to remote server UEA-Test2PC failed with the following error message : WinRM
cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over
the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By
default, the WinRM firewall exception for public profiles limits access to remote computers within the same local
subnet.
Any tips?