Troubleshooting a WinRM Error when using Invoke-WUJob to update PCS for windows updates remotely?

Tyler Ramirez 1 Reputation point
2021-04-19T17:39:31.867+00:00

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?

Windows for business Windows Server User experience PowerShell
Windows for business Windows Server User experience Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Carl Fan 6,881 Reputation points
    2021-04-20T09:07:57.67+00:00

    Hi,
    Based on your description, did you check the netsh proxy via the netsh winhttp show proxy command?
    Just to confirm, It should show Direct Access (No proxy server).

    Please run winrm quickconfig to see if it returns the following information:

    WinRM service is already running on this machine.
    WinRM is not set up to allow remote access to this machine for management.

    If so, follow the guide to make the changes and have WinRM configured automatically.
    Just like the information below:
    https://stackoverflow.com/questions/39917027/winrm-cannot-complete-the-operation-verify-that-the-specified-computer-name-is
    Besides, is there any anti-virus software installed on your Exchange server?
    If there is, please uninstall them and see if the problem persists.
    Hope this helps and please help to accept as Answer if the response is useful.
    Best Regards,
    Carl


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.