Bootstrap FreeKB - PowerShell - Resolve "The WinRM client cannot complete the operation within the time specified"
PowerShell - Resolve "The WinRM client cannot complete the operation within the time specified"

Updated:   |  PowerShell articles

To resolve error "The WinRM client cannot complete the operation within the time specified" in PowerShell:

On both the source and target computer, ensure the WinRM service is Runnning. If the WinRM service is not running, Start-Service WinRM.

PS C:\> Get-Service WinRM

Status    Name     DisplayName
------    ----     -----------
Running   winrm    Windows Remote Management

 

The Start-Service WinRM command can be used to start the WinRM service.

PS C:\> Start-Service WinRM

 

Configure WinRM to for remote management using the Set-WSManQuickConfig command.

PS C:\> Set-WSManQuickConfig

WinRM Quick Configuration
. . .
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y
WinRM is set up to receive requests on this machine.
WinRM is set up for remote management on this machine.

 

Configure WinRM for remote management using the Enable-PSRemoting command:

PS C:\> Enable-PSRemoting

WinRM Quick Configuration
. . .
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y
WinRM is set up to receive requests on this machine.
WinRM is set up for remote management on this machine.

 

Configure WinRM to trust the target computer. Hostname can be a single PC, numerous PCs, or a wildcard.

PS C:\> Set-Item WSMan:\localhost\Client\TrustedHosts -Value "hostname" -Force

 

Use the Test-WSMan command to test the connection.

PS C:\> Test-WSMan -computername hostname
Test-WSMan : The WinRM client cannot complete the operation within the time specified. . .

 

Attempt to connect to the target PC using telnet on ports 5985 (HTTP) and 5986 (HTTPS).

PS C:\> telnet x.x.x.x 5985

 

Use this command to see if the firewall is listening on port 5985. 

PS C:\> netsh firewall show state | select-string 59

 

Nmap can also be used to list the open, closed, and blocked ports.

 

Check the Event Viewer for errors. In this example, Event Viewer has error "The WinRM service could not use the following listener to receive WS-Management requests. The listener is enabled but the listener does not have an IP address configured."

?




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 0b77b5 in the box below so that we can be sure you are a human.