-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Documentation Needed in this repoDocumentation is needed in this repoDocumentation is needed in this repoResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-RemotingPSRP issues with any transport layerPSRP issues with any transport layer
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to the known issues.
Steps to reproduce
I can't get OperationTimeout setting to work with New-PsSession. Please refer to this post I posted earlier today in StackOverflow.
In a short, I found a supposedly working snippet at Windows Powershell In Action 2nd Edition, by Bruce Payette, at Chapter 13 - Remoting.
I slightly adapted the script to look as follows:
$password = "myPass"
$domainAndUser = "myDomain&User"
$computerName = "myRemoteComputerIp"
$pwSession = convertto-securestring -AsPlainText -Force $password
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $domainAndUser,$pwSession
$pso = New-PSSessionOption -OperationTimeout (5*1000)
$session = new-pssession -computername $computerName -credential $cred -SessionOption $pso
Invoke-Command $session { 1..10 | foreach {"$_" + ('*' * $_) ; Start-Sleep 1} }
I expected to see the same The WinRM client cannot complete the operation within the time specified error as described in the snippet from the book. But I am not able to achieve such result. Tried several variations.
Reproduces in both Powershell 5.1 and 7.1.3, on Windows.
Expected behavior
Error `The WinRM client cannot complete
the operation within the time specified` should be displayed.Actual behavior
Invoke-Command script block proceeds till completion, without being aborted due timeout.Environment data
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response
mklement0 and santisq
Metadata
Metadata
Assignees
Labels
Documentation Needed in this repoDocumentation is needed in this repoDocumentation is needed in this repoResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-RemotingPSRP issues with any transport layerPSRP issues with any transport layer