更改远程PowerShell重新连接超时
当远程PowerShell会话打开且TCP停止工作时(例如,电源关闭/电缆断开/…),Invoke命令或Remove PSSession命令会在尝试重新连接时阻塞几分钟 我想把这个超时时间减少到5秒 在Invoke命令中,我得到了警告更改远程PowerShell重新连接超时,powershell,powershell-remoting,winrm,Powershell,Powershell Remoting,Winrm,当远程PowerShell会话打开且TCP停止工作时(例如,电源关闭/电缆断开/…),Invoke命令或Remove PSSession命令会在尝试重新连接时阻塞几分钟 我想把这个超时时间减少到5秒 在Invoke命令中,我得到了警告 WARNING: The network connection to 192.168.30.106 has been interrupted. Attempting to reconnect for up to 4 minutes... WARNING: Atte
WARNING: The network connection to 192.168.30.106 has been interrupted. Attempting to reconnect for up to 4 minutes...
WARNING: Attempting to reconnect to 192.168.30.106 ...
WARNING: Attempting to reconnect to 192.168.30.106 ...
WARNING: Attempting to reconnect to 192.168.30.106 ...
WARNING: Attempting to reconnect to 192.168.30.106 ...
WARNING: Attempting to reconnect to 192.168.30.106 ...
WARNING: Attempting to reconnect to 192.168.30.106 ...
WARNING: Attempting to reconnect to 192.168.30.106 ...
WARNING: The reconnection attempt to 192.168.30.106 failed. Attempting to disconnect the session...
WARNING: Computer 192.168.30.106 has been successfully disconnected.
Invoke-Command : Network connectivity to 192.168.30.106 has been lost and the reconnection attempt failed. Please repair the network connection and reconnect using Connect-PSSession or
Receive-PSSession.
At line:4 char:1
+ Invoke-Command -Session $remoteSession -ScriptBlock {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationTimeout: ([PSSession]Session7:PSSession) [Invoke-Command], RuntimeException
+ FullyQualifiedErrorId : PowerShellNetworkFailedStartDisconnect,Microsoft.PowerShell.Commands.InvokeCommandCommand
Remove PSSession似乎使用了不同的超时(大约100秒)
OpenTimeout、OperationTimeout、IdleTimeout和CancelTimeout似乎都不会影响这些超时
我想我需要一些较低级别的超时选项。那在什么地方存在吗