question

TylerRamirez-6112 avatar image
0 Votes"
TylerRamirez-6112 asked TylerRamirez-6112 commented

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

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-server-powershellwindows-server-2019
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

CarlFan-MSFT avatar image
0 Votes"
CarlFan-MSFT answered TylerRamirez-6112 commented

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

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello, thank you for your quick response. I have winrm quickconfig already done, and netsh winhttp show proxy shows Direct Access(no proxy server.) I have also done everything in the guide listed for stack overflow. There is no antivirus software installed.

0 Votes 0 ·