diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs index 9810c3c1b29..b684ce3ee02 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs @@ -127,6 +127,14 @@ public class TestConnectionCommand : PSCmdlet [ValidateRange((int)0, (int)65500)] public Int32 BufferSize { get; set; } = 32; + /// + /// The following is the definition of the input parameter "TimeOut". + /// Time-out value in milliseconds. If a response is not received in this time, no response is assumed. The default is 1000 milliseconds. + /// + [Parameter] + [ValidateRange((int)1, Int32.MaxValue)] + public Int32 TimeOut { get; set; } = 1000; + /// /// The following is the definition of the input parameter "ComputerName". /// Value of the address requested. The form of the value can be either the @@ -399,6 +407,9 @@ private string QueryString(string[] machinenames, bool escaperequired, bool sele FilterString.Append(" And "); FilterString.Append("BufferSize="); FilterString.Append(BufferSize); + FilterString.Append(" And "); + FilterString.Append("TimeOut="); + FilterString.Append(TimeOut); FilterString.Append(")"); return FilterString.ToString(); } @@ -612,6 +623,7 @@ private void ProcessWSManProtocolForTestConnection() using (CimSession cimSession = RemoteDiscoveryHelper.CreateCimSession(sourceComp, this.Credential, WsmanAuthentication, cancel.Token, this)) { + WriteVerbose(String.Format("WMI query {0} sent to {1}", querystring, sourceComp)); for (int echoRequestCount = 0; echoRequestCount < Count; echoRequestCount++) { IEnumerable mCollection = cimSession.QueryInstances(