Click or drag to resize

OperatingSystemDynamicInfoProvider Constructor

Initializes a new instance of the OperatingSystemDynamicInfoProvider class.

Namespace:  Xcalibur.WMI.OperatingSystem
Assembly:  Xcalibur.WMI (in Xcalibur.WMI.dll) Version: 3.0.0.0 (3.0.1.0)
Syntax
public OperatingSystemDynamicInfoProvider(
	ManagementScope ms
)

Parameters

ms
Type: System.ManagementManagementScope
The management scope.
Examples
C#
 1// Main
 2private static void Main()
 3{
 4    // Make a connection to the local machine
 5    const string computer = ".";
 6    var managementScope = new ManagementScope($@"\\{computer}\root\cimv2", new ConnectionOptions
 7    {
 8        Impersonation = ImpersonationLevel.Impersonate,
 9        Authentication = AuthenticationLevel.Connect
10    });
11    managementScope.Connect();
12
13    // OS Dynamic information
14    var provider = new OperatingSystemDynamicInfoProvider(managementScope);
15
16    // Fetch data
17    provider.Refresh();
18
19    // Print
20    foreach (var info in provider.Results)
21    {
22        Console.WriteLine($"Free Physical Memory: \t{info.FreePhysicalMemory:n0}");
23        Console.WriteLine($"Free Virtual Memory: \t{info.FreeVirtualMemory:n0}");
24    }
25
26    // Read
27    Console.Read();
28}
29
30/* Results: 
31 * 
32 * Free Physical Memory:   21,685,440
33 * Free Virtual Memory:    22,011,000
34 * 
35 */
See Also