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

Home > Search


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

 

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."

?



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




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




Comments