WqlEventQuery.Condition Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the condition to be applied to events of the specified class.
public:
property System::String ^ Condition { System::String ^ get(); void set(System::String ^ value); };
public string Condition { get; set; }
member this.Condition : string with get, set
Public Property Condition As String
Returns a String value containing the condition or conditions in the event query.
The following example initializes a new WqlEventQuery and displays the event query string.
using System;
using System.Management;
public class EventSample
{
public static void Main(string[] args)
{
WqlEventQuery query = new WqlEventQuery();
query.EventClassName = "__InstanceCreationEvent";
query.Condition = "TargetInstance ISA 'Win32_NTLogEvent'";
query.GroupWithinInterval = new TimeSpan(0, 0, 10);
System.Collections.Specialized.StringCollection collection =
new System.Collections.Specialized.StringCollection();
collection.Add("TargetInstance.SourceName");
query.GroupByPropertyList = collection;
query.HavingCondition = "NumberOfEvents > 25";
Console.WriteLine(query.QueryString);
return;
}
}
Imports System.Management
Public Class EventSample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
Dim query As New WqlEventQuery
query.EventClassName = "__InstanceCreationEvent"
query.Condition = "TargetInstance ISA 'Win32_NTLogEvent'"
query.GroupWithinInterval = New TimeSpan(0, 0, 10)
Dim collection As New System.Collections.Specialized. _
StringCollection
collection.Add("TargetInstance.SourceName")
query.GroupByPropertyList = collection
query.HavingCondition = "NumberOfEvents > 25"
MessageBox.Show(query.QueryString)
End Function 'Main
End Class
Setting this property value overrides any previous value stored in the object. The query string is rebuilt to reflect the new condition.
The condition is represented as a string, containing one or more clauses of the form: <propName> <operator> <value> combined with logical operators. <propName> must represent a property defined on the event class specified in this query.
Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Prodotto | Versioni |
---|---|
.NET | 8 (package-provided), 9 (package-provided) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Feedback su .NET
.NET è un progetto di open source. Selezionare un collegamento per fornire feedback: