Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ public class TestConnectionCommand : PSCmdlet
[ValidateRange((int)0, (int)65500)]
public Int32 BufferSize { get; set; } = 32;

/// <summary>
/// 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.
/// </summary>
[Parameter]
[ValidateRange((int)1, Int32.MaxValue)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never liked this use of ValidateRange - it seems like we should have ValidatePositive and ValidateNonNegative attributes.

public Int32 TimeOut { get; set; } = 1000;

/// <summary>
/// The following is the definition of the input parameter "ComputerName".
/// Value of the address requested. The form of the value can be either the
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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<CimInstance> mCollection = cimSession.QueryInstances(
Expand Down