Use WMI to get detailed information for remote machine operating systems

xiaoxiao2021-03-06  59

OperatingSystem class code is part of the theme is the use of tools (Management (WMI) Extensions for Visual Studio .NET 2003 Server Explorer http://www.microsoft.com/downloads/details.aspx?displaylang=zh-cn&FamilyID=62d91a63-1253- 4EA6-8599-68FB3EF77DE1) is generated. using System; using System.Management; using System.ComponentModel; using System.Collections; using System.Globalization; using System.ComponentModel.Design.Serialization; using System.Reflection;

public class Program {static void Main (string [] args) {try {ConnectionOptions co = new ConnectionOptions (); co.Username = "administrator"; co.Password = "lacl"; System.Management.ManagementScope ms = new System. Management.ManagementScope (" " 192.168.103.2 " " // root // CIMv2 ", CO);

System.Management.ObjectQuery oq = new system.Management.ObjectQuery ("Select * from win32_operatingsystem);

ManagementObjectSearcher query1 = new ManagementObjectSearcher (ms, oq); ManagementObjectCollection queryCollection1 = query1.Get (); foreach (ManagementObject mo in queryCollection1) {OperatingSystem os = new OperatingSystem (mo); Console.WriteLine (os.Name);}} catch ( Exception EE) {Console.WriteLine ("An exception has occurred."); Console.writeLine (Ee.Message);}}}

//HOULDSERIALIZE function is a function that the VS property browser is used to check if the specific attribute must serialize. For all valueetype properties (type INT32, BOOL, etc. "cannot set them empty) Add these functions. These functions use the IS Null function. These functions are also used in the TypeConverter implementation of the attribute to check the NULL value of the property to display null values ​​in the Properties browser when dragging in Visual Studio. // Function Is NULL () is used to check if the property is NULL. / / To add a reset function to the read / write attribute that can be null. These functions are used by the VS designer to set the properties to NULL in the property browser. // Each attribute of the class added to the WMI property has the behavior in the Visual Studio designer and the type of TypeConverter to be used. // DateTime Conversion Function TodateTime and TodmTFDateTime Add to classes to convert DMTF datetime to System.DateTime (or vice versa). / / Early binding class generated for WMI classes. Win32_OperatingSystem Public Class OperatingSystem: system.comPonentModel.comPonent {// is used to save private properties of WMI namespace reside resilient in this class. Private static string createdWMINAMESPACE = "root // CIMv2"; // Private properties, save the name of the WMI class created such a class. Private static string createdClassName = "WIN32_OPERATINGSYSTEM"; // The private member variable for saving ManagementScope used by various methods. Private static system.management.managementScope statmggmtscope = null; private managementsystemproperties; // Basic LateBound WMI object. Private system.management.managementObject privateLateBoundObject; // Store member variables of the "Auto Submit" behavior. Private Bool AutoCommitProp = true; // Save private variables for embedded properties of the instance. Private system.management.managementBaseObject EmbedDedObj; // The current WMI object private system.management.managementBaseObject curobj; // is used to indicate whether the instance is a flag of embedded object. Private bool iSEMBEDDED = false; // The following is a different overload using the constructor of the WMI object initialization class instance.

public OperatingSystem (): this (((System.Management.ManagementScope) (null)), ((System.Management.ManagementPath) (null)), ((System.Management.ObjectGetOptions) (null))) {} public OperatingSystem (string keyName): this (((System.Management.ManagementScope) (null)), ((System.Management.ManagementPath) (new System.Management.ManagementPath (OperatingSystem.ConstructPath (keyName)))), ((System. Management.ObjectGetOptions) (null))) {} public OperatingSystem (System.Management.ManagementScope mgmtScope, string keyName): this (((System.Management.ManagementScope) (mgmtScope)), ((System.Management.ManagementPath) (new System.Management.ManagementPath (OperatingSystem.ConstructPath (keyName)))), ((System.Management.ObjectGetOptions) (null))) {} public OperatingSystem (System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions): this ((System.Management.ManagementScope) ((System.Management.ManagementPath) ((System.Man) agement.ObjectGetOptions) (getOptions))) {} public OperatingSystem (System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path): this (((System.Management.ManagementScope) (mgmtScope)), ((System.Management. ManagementPath) (path)), ((System.Management.ObjectGetOptions) (null))) {} public OperatingSystem (System.Management.ManagementPath path): this (((System.Management.ManagementScope) (null)), (( System.Management.ManagementPath) (path)), ((System.Management.ObjectGetOptions) (null))) {} public OperatingSystem (System.Management.ManagementScope mgmtScope, System.Management.ManagementPath path, System.Management.ObjectGetOptions getOptions) {IF (((PATH! =

null)) {! if ((CheckIfProperClass (mgmtScope, path, getOptions) = true)) {throw new System.ArgumentException ( "class name does not match.");}} PrivateLateBoundObject = new System.Management.ManagementObject (mgmtScope, path , getOptions); PrivateSystemProperties = new ManagementSystemProperties (PrivateLateBoundObject); curObj = PrivateLateBoundObject;} public OperatingSystem (System.Management.ManagementObject theObject) {if ((CheckIfProperClass (theObject) == true)) {PrivateLateBoundObject = theObject; PrivateSystemProperties = new ManagementSystemProperties ( PrivateLateBoundObject); curObj = PrivateLateBoundObject;} else {throw new System.ArgumentException ( "class name does not match.");}} public OperatingSystem (System.Management.ManagementBaseObject theObject) {if ((CheckIfProperClass (theObject) == true)) {Embeddedobj = theObject; privatestemproperties = new management; curobj = EmbeddedObj; ISEMBED Ded = true;} else {throw new system.ArgumentException ("Class name does not match. ");}} // Attributes Returns the namespace of the WMI class.

[Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public string OriginatingNamespace {get {return "ROOT // CIMV2";}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public string ManagementClassName {get { String strret = createdclassname; if (curobj! = null) {if (curobj.classpath! = null) {strret = ((string)); if (((((((((((((((strret ==) NULL) || (STRRET == System.String.empty)))))))))))))))) {STRET = CREATEDCLASSNAME;}}} Return Strret;}} // Points the properties of the embedded object to get the system properties of the WMI object. [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public ManagementSystemProperties SystemProperties {get {return PrivateSystemProperties;}} // Returns LateBound properties of the base object. [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public System.Management.ManagementBaseObject LateBoundObject {get {return curObj;}} // ManagementScope object. [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public System.Management.ManagementScope Scope {get {if ((isEmbedded == false)) {return PrivateLateBoundObject.Scope;} else {return null;}} set {if ((ISEMBEDDED == false)) {privateLateBoundObject.scope = value;}}} ///

/// Displays the properties of the submission behavior of the WMI object. If true, the WMI object is automatically saved after each attribute modification (ie, calling Put ()).

/// [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool AutoCommit {get {return AutoCommitProp;} set {AutoCommitProp = value;}} // ManagementPath base WMI object. [Browsable (true)] public System.Management.ManagementPath Path {get {if ((isEmbedded == false)) {return PrivateLateBoundObject.Path;} else {return null;}} set {if ((isEmbedded == false)) {IF ((CHECKIFPROPERCLASS (NULL, VALUE, NULL)! = True)) {throw new system.ArgumentException ("Class name does not match.");} PrivateLateBoundObject.path = value;}}} // is used by various methods Public static range properties. [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public static System.Management.ManagementScope StaticScope {get {return statMgmtScope;} set {statMgmtScope = value;}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden) ] [Description ("BootDevice property indicates the name of the disk drive that Win32 operating system startup ./n, for example: device // harddisk0.")] PUBLIC STRING BootDevice {get {return ((string) (Curobj ["bootdevice"]) }} [Debowsable (true)] [DesignerIzationVisibility.hidden] [Description ("BuildNumber property represents the internal version number of the operating system. Can be used to more accurate version information than the product release number ./n, for example: 1381 ")] public string BuildNumber {get {return ((string) (curObj [" BuildNumber "]));}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description (" BuildType attribute represents a operation The internal version of the system. Such as sales versions and checkups.

")] Public string BuildType {get {return ((string) (curObj [" BuildType "]));}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description (" Caption property is a short object text description (character string line) ")] public string Caption {get {return ((string) (curObj [" Caption "]));}}. [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [description ("The CODESET property indicates the encoded page value used by the operating system. The code page contains the character table of the operating system for different language translation strings. TheAmerican National Standards INS" TITUTE (ANSI) lists the defined encoded page. Value. If the operating system does not use the ANSI code page, this member will be set to the 0.codset string You can define the value of the code page " " with six characters ./n, for example: 1255. ")] public string code {Get {RETURN ("CODESET"]);}} [debowsable (true)] [DesignerIzationVisibility.hidden] [Description ("Countrycode property represents the country (region) encoding by the operating system. The value is based on the prefix of international telephone dialing (also as an IBM country) code. COUNTRYCODE string can " " use six characters to define the value of the country (region), for example: 1 means USA) ")] Public string countrycode { get {return ((string) (curObj [ "CountryCode"]));}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "CreationClassName indicates the name of the category or subcategory to create a paradigm . This attribute allows all the examples of this category and its subcaters when used together with the other primary properties of this category. ")] Public string CreationClassName {get {return ((string) (curObj [" CreationClassName "]));}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description (" CSCreationClassName scoping computer system comprising Create a category name.

")] Public string CSCreationClassName {get {return ((string) (curObj [" CSCreationClassName "]));}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description (" CSDVersion attribute contains a null-terminated The string can represent the latest service pack installed on the computer system. This value is NULL if the service package is installed. This property contains information providing arbitration information about other operating systems for the Windows " " 95. A NULL end string ./n, for example: service pack 3. ")] public string csdversion {get {return ((string) (CUROBJ [" csdversion "));}} [Browsable (TRUE)] [DesignerSerizationVisibility) DesignerSerizationVisibility.hidden)] [Description ("CSName contains the name of the scope computer system.")] PUBLIC STRING CSNAME {Get {Return ((String) (CSNAME "));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsCurrentTimeZoneNull {get {if ((curObj [ "CurrentTimeZone"] == null)) {return true;} else {return false;}}} [Browsable (t RUE)] [DesignerSerizationVisibility.hidden] [Description ("CurrentTimezone indicates the number of minutes adjustments from the operating system from Greenwich time. The number is not a positive, and the negative number is zero.

")] [TypeConverter (typeof (WMIValueTypeConverter))] public short CurrentTimeZone {get {if ((curObj [" CurrentTimeZone "] == null)) {return System.Convert.ToInt16 (0);} return ((short) ( Curobj ["currenttimezone"]);} set {curobj ["currenttimezone"] = value; if ((iSembedded == false) && (autocmitprop == true)) {privateLateBoundObject.put ();}}}} [ Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsDebugNull {get {if ((curObj [ "Debug"] == null)) {return true;} else {return false;}}} [Browsable (true ] [DesignerSerizationVisibility.hidden] [Description ("Debug Properties indicates whether the internal version of the operating system is checked. The inside of the inspection provides error check, parameter authentication, and system debug coding. Others are checked The binary generated kernel adjustment error message and debugger " " endproof. This can help immediately determine the cause and location of the error. Operation is affected by other encodes executed in the inspection ./N value: True or False The TRUE value represents the debug version of the USER " " .exe installed. ") [TypeConverter (TypeOf (WMIVALUETY) PECONVERTER)] Public Bool Debug {Get {IF ((Curobj ["Debug"] == NULL)) {Return System.convert.toboolean (0);} Return ((Bool) (CUROBJ ["debug")) }} [Debowsable] [DesignerSerizationVisibility.hidden] [Description attribute provides a description of the Windows operating system. Some users' interfaces (those that allow editing of this description) limit their length to 48 characters.

")] Public string description {get {return ((string));} set {curobj [" description "] = value; if ((iSembedded == false) && (AutoCommitProp == true))) {PrivateLateBoundObject.Put ();}}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsDistributedNull {get {if ((curObj [ "Distributed"] == null)) {return Else {Return False;}}} [Browsable (TRUE)] [DesignerIzationVisibility.hidden] [Description "means that the operating system is issued on several computer system nodes. If this is the case, These nodes should form a cluster. ")] [TypeConverter (TypeF (WMIVALUETYPECONVERTER)] PUBLIC BOOL Distributed {Get {IF ((Curobj [" Distributed "] == NULL) {Return System.convert.toboolean (0); } Return ((Bool) (Curobj ["Distributed"]);}} [Browsable (false)] [DesignerSerizationVisibility (DesignerSerizationVis) ibility.Hidden)] public bool IsEncryptionLevelNull {get {if ((curObj [ "EncryptionLevel"] == null)) {return true;} else {return false;}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden )] [Description ("EncryptionLevel property is used to represent the encryption level, 40-bit, 128-bit or N bit used by the security transaction.

")] [TypeConverter (typeof (WMIValueTypeConverter))] public EncryptionLevelValues ​​EncryptionLevel {get {if ((curObj [" EncryptionLevel "] == null)) {return ((EncryptionLevelValues) (System.Convert.ToInt32 (0))); } return ((EncryptionLevelValues) (Convert.ToInt32 (curObj [ "EncryptionLevel"])));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsForegroundApplicationBoostNull {get {if ((curObj [ "ForegroundApplicationBoost "] == null)) {return true;} else {return false;}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description (@" ForegroundApplicationBoost attribute indicates the priority to the foreground application increased On the computer system running Windows NT 4.0 and Windows 2000, the application expansion is achieved by the "Quantum lengths), and the system expands 6 quantum lengths when the system is expanded; if 1, then 12; The priority is increased by this attribute. The default is 2.

")] [TypeConverter (typeof (WMIValueTypeConverter))] public ForegroundApplicationBoostValues ​​ForegroundApplicationBoost {get {if ((curObj [" ForegroundApplicationBoost "] == null)) {return ((ForegroundApplicationBoostValues) (System.Convert.ToInt32 (0))); } return ((ForegroundApplicationBoostValues) (Convert.ToInt32 (curObj [ "ForegroundApplicationBoost"])));} set {curObj [ "ForegroundApplicationBoost"] = value; if (((isEmbedded == false) && (AutoCommitProp == true)) ) {PrivateLateBoundObject.Put ();}}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsFreePhysicalMemoryNull {get {if ((curObj [ "FreePhysicalMemory"] == null)) {return true;} Else {RETURN FALSE;}}} [Browsable] [DesignerIzationVisibility.hidden] [Description ("Unused and available physical memory for KB number.

")] [TypeConverter (typeof (WMIValueTypeConverter))] public System.UInt64 FreePhysicalMemory {get {if ((curObj [" FreePhysicalMemory "] == null)) {return System.Convert.ToUInt64 (0);} return ((System .UInt64) (curObj [ "FreePhysicalMemory"]));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsFreeSpaceInPagingFilesNull {get {if ((curObj [ "FreeSpaceInPagingFiles"] == null)) { Return True;}}}} [Browsable (True)] [DesignerIzationVisibility.hidden] [Description "] [Description" [Description "[Description" [Description "[Description (" You can map to the operating system page file, and will not cause other pages to be changed All KB (kilobytes) Number .0 indicates no page files. ")] [TypeConverter (TypeF (WMIVALUETYPECONVERTER)] public system.uint64 FreeSpaceInPagingFiles {Get {IF ((Curobj [" FreeSpaceInPagingFiles "] == null) { Return system.convert.touint64 (0);} return ((system.uint64) (Curobj ["FREESPACEINPAGINGFILES"); }} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsFreeVirtualMemoryNull {get {if ((curObj [ "FreeVirtualMemory"] == null)) {return true;} else {return false;}}} [ Browsable (TRUE)] [DesignerSerizationVisibility.hidden] [Description ("" The number of KBs currently not used and available in virtual memory. For example, this can be added by adding idle RAM number and free Paging space (such as adding properties, FreePhysicalMemory, and Free " " spaceinPagingFiles).

")] [TypeConverter (typeof (WMIValueTypeConverter))] public System.UInt64 FreeVirtualMemory {get {if ((curObj [" FreeVirtualMemory "] == null)) {return System.Convert.ToUInt64 (0);} return ((System .UInt64) (curObj [ "FreeVirtualMemory"]));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsInstallDateNull {get {if ((curObj [ "InstallDate"] == null)) { Return True;}}}} [Browsable] [DesignerIzationVisibility.hidden] [Description "] [Description (" InstallDate property is a datetime value indicating the installation object. No value does not mean that the object is not installed . ")] [TypeConverter (typeof (WMIValueTypeConverter))] public System.DateTime InstallDate {get {if ((curObj [" InstallDate "]! = null)) {return ToDateTime (((string) (curObj [" InstallDate "] ))))));} Else {return system.datetime.minvalue;}}} [Browsable (false)] [design erSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsLargeSystemCacheNull {get {if ((curObj [ "LargeSystemCache"] == null)) {return true;} else {return false;}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility .Hidden)] [Description ("LARGESYSTEMCACHE attribute indicates whether the application is an application (value = 0) or system performance (value = 1).

")] [TypeConverter (typeof (WMIValueTypeConverter))] public LargeSystemCacheValues ​​LargeSystemCache {get {if ((curObj [" LargeSystemCache "] == null)) {return ((LargeSystemCacheValues) (System.Convert.ToInt64 (0))); } return ((LargeSystemCacheValues) (Convert.ToInt64 (curObj [ "LargeSystemCache"])));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsLastBootUpTimeNull {get {if ((curObj [ "LastBootUpTime "] == NULL)) {Return true;}}}} [browsable (true)] [DesignerIzationVisibility.hidden] [Description (" The last time the operating system last starts. ")] [ TypeConverter (typeof (WMIValueTypeConverter))] public System.DateTime LastBootUpTime {get {if ((curObj [ "LastBootUpTime"] = null)!) {return ToDateTime (((string) (curObj [ "LastBootUpTime"])));} Else {Return System.datetime.minvalue; }}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsLocalDateTimeNull {get {if ((curObj [ "LocalDateTime"] == null)) {return true;} else {return false;}}} [Browsable] [DesignerSerizationVisibility.hidden] [Description ("The local date and time tag of the operating system.

")] [TypeConverter (typeof (WMIValueTypeConverter))] public System.DateTime LocalDateTime {get {if ((curObj [" LocalDateTime "]! = Null)) {return ToDateTime (((string) (curObj [" LocalDateTime "]) ));} else {return System.DateTime.MinValue;}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "Locale language attribute indicates an identifier of the language used by the operating system identifier Yes. The abbreviation of the standard international number of a country. Each language has a language identifier (langID), 16-bit value of the primary language identifier and " " secondary language identifier. ")] Public string locale { GET {Return ((string));}} [debowsable (true)] [DesignerIzationVisibility.hidden] [Description ("Manufacturer property represents the operating system manufacturer name. For Win32 system, this value is the Microsoft Corporation ")] public string Manufacturer {get {return ((string) (curObj [" Manufacturer "]));}}. [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsMaxNumbe rOfProcessesNull {get {if ((curObj [ "MaxNumberOfProcesses"] == null)) {return true;} else {return false;}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "Operation The system can support the maximum number of procedures. If there is no fixed maximum, the value should be 0. With a fixed maximum system, this object can help diagnose the fault that appears when the maximum is reached. If not, enter -1.

" " ")] [TypeConverter (typeof (WMIValueTypeConverter))] public System.UInt32 MaxNumberOfProcesses {get {if ((curObj [" MaxNumberOfProcesses "] == null)) {return System.Convert.ToUInt32 (0);} return ((System.UInt32) (curObj [ "MaxNumberOfProcesses"]));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsMaxProcessMemorySizeNull {get {if ((curObj [ "MaxProcessMemorySize"] == null )) {RETURN TRUE;} Else {RETURN FALSE;}}} [Browsable (True)] [DesignerIzationVisibility.hidden] [Description "[Description" can be assigned to a maximum KB value memory for a process. For operation without virtual memory System, this value is generally equal to the physical memory subtraction to the memory used by BIOS and OS. For some operating systems, this value " " may be unlimited - in this case, I should type 0. Other In case, this value may be fixed-, for example, 2g or 4G. ")] [TypeConverter (TypeF (WMIVALUETYPECONVERTER)] public system.uint64 maxProcessMemorySize {get {ix ((curobj [" MaxProcessMemorySize "] == null)) {Return System.Convert.ToUInt64 (0);} return ((System.UInt64) (curObj [ "MaxProcessMemorySize"]));}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "inherited Name Attributes as an item of an operating system in a computer system.

")] Public string Name {get {return ((string) (curObj [" Name "]));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsNumberOfLicensedUsersNull {get {if ((curObj [ "NumberOfLicensedUsers"] == null)) {return true;} else {return false;}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "the number of the operating system if the user licenses. 0. If there is no limitation type known type -1. ")] [TypeConverter (typeof (WMIValueTypeConverter))] public System.UInt32 NumberOfLicensedUsers {get {if ((curObj [" NumberOfLicensedUsers "] == null)) {return System .Convert.ToUInt32 (0);} return ((System.UInt32) (curObj [ "NumberOfLicensedUsers"]));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsNumberOfProcessesNull {get {if ( (Curobj ["Numberofprocesses"] == NULL)) {Return True;}}}} [Browsable (True)] [DesignerIzationVisibility.hidden] [Description ("The number of processes currently loaded or running on the operating system.

")] [TypeConverter (typeof (WMIValueTypeConverter))] public System.UInt32 NumberOfProcesses {get {if ((curObj [" NumberOfProcesses "] == null)) {return System.Convert.ToUInt32 (0);} return ((System .UInt32) (curObj [ "NumberOfProcesses"]));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsNumberOfUsersNull {get {if ((curObj [ "NumberOfUsers"] == null)) { return true;} else {return false; [( ". user sessions its operating system to store the current state information") Description]}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [TypeConverter (typeof (WMIVALUETYPECONVERTER)] Public system.uint32 Numberofusers {Get {IF ((Curobj ["Numberofusers"] == NULL) {Return System.convert.touint32 (0);} return ((system.uint32) ("system.uint32) Numberofusers "]));}} [browsable (true)] [DesignerSerizationVisibility (DesignerSeri AlizationalVisibility.hidden)] [Description ("Organization property indicates the company name of the registered user (operating system). / N, for example, Microsoft. ")] Public string Organization {get {return ((string) (curObj [" Organization "]));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsOSLanguageNull {get {if ((curObj [ "OSLanguage"] == null)) {return true;} else {return false;}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "OSLanguage attribute indicates the language version of the operating system installation .

/ N, for example: 0x0807 (German, Switzerland) ")] [TypeConverter (TypeOf (WMIVALUETYPECONVERTER)] public system.uint32 Oslanguage {Get {IF ((Curobj [" osLANGuage "] == null) {return system.convert. ToUInt32 (0);} return ((System.UInt32) (curObj [ "OSLanguage"]));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsOSProductSuiteNull {get {if ((curObj [ "OSProductSuite"] == null)) {return true;} else {return false;}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "OSProductSuite attribute represents the operating system installed and authorization system products. ")] [TypeConverter (typeof (WMIValueTypeConverter))] public OSProductSuiteValues ​​OSProductSuite {get {if ((curObj [" OSProductSuite "] == null)) {return ((OSProductSuiteValues) (System.Convert.ToInt32 (0 ))));} Return (OSProductSuiteValues) (Curobj ["ockproductsuite"))); } [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsOSTypeNull {get {if ((curObj [ "OSType"] == null)) {return true;} else {return false;}}} [Browsable (TRUE)] [DesignerSerializationVisibility.hidden] [Description "indicates an integer of the operating system species.

")] [TypeConverter (TypeOf (WMIVALUETYPECONVERTER)] public OSTYPEVALUES OSTYPE {GET {IF ((curobj [" TYPE "] == null) {return (ostypevalues) (System.convert.Toint32 (0)); } return ((OSTypeValues) (Convert.ToInt32 (curObj [ "OSType"])));}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [description ( "describes the type of operating system and manufacturer characters String - When operating system properties, OSTYPE is set to 1 ("Other"). Type the word " " string format in OthertypedScription, the format of the string value defined for the OSTYPE. When the OSTYPE value is 1 at any other value, OtherTypeDescription should be set to the N " " ULL ")] public string OtherTypeDescription {get {return ((string) (curObj [". OtherTypeDescription "]));}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "PlusProductID attribute contains the Windows Plus! operating system enhancement software (product identification number if fitted) of.")] public string PlusProductID {get {return ((string) (curObj [ "PlusProductID "]));}} [Browsable (true)] [DesignerSerial IzationVisibility (DesignerSerializationVisibility)] [Description "The version number of the Windows Plus! Operating System Enhancements (if installed).

")] Public string PlusVersionNumber {get {return ((string) (curObj [" PlusVersionNumber "]));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsPrimaryNull {get {if ((curObj [ "primary"] == null)) {return true;} else {return false;}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "primary property determines whether this is the main operating System ./N value: true or false.true value represents this is the main operating system. ")] [TypeConverter (TypeF (WMIVALUETYPECONVERTER)] PUBLIC BOOL PRIMARY {Get {IF ((Curobj [" Primary "== null )) {return System.Convert.ToBoolean (0);} return ((bool) (curObj [ "Primary"]));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsProductTypeNull {get {IF ((Curobj ["ProductType"] == NULL)) {Return True;} else {RETU Rn false;}}} [debowsable (true) [DesignerIzationVisibility.hidden] [Description ("ProductType indicates additional information about this system.

This number can be a value below: / n1 - Workstation / N2 - Domain Controller / N3 - Server ")] [TypeConverter (TypeOf (WMIVALUETYPECONVERTER)] Public ProductTypevalues ​​ProductType {Get {ix ((Curobj [" ProductType " == NULL)) {return ("system.convert.toint64 (0)));} Return (CONVERTTYPEVALUES) (Curobj [" ProductType ")));}} [Browsable (False )] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsQuantumLengthNull {get {if ((curObj [ "QuantumLength"] == null)) {return true;} else {return false;}}} [Browsable (true)] [ DesignerserizationVisibility.hidden] [Description ("QuantumLength property defines the number of hours of each quantum. One quantum is the execution time unit of the plan program to give the application before converting to other applications. When thread runs a quantum, the kernel It is the application of " " to " " to move it to the end of the column. The actual length of the quantum of thread is different on a variety of Windows platforms. It is only for Windows NT / Windows 2000.

")] [TypeConverter (typeof (WMIValueTypeConverter))] public QuantumLengthValues ​​QuantumLength {get {if ((curObj [" QuantumLength "] == null)) {return ((QuantumLengthValues) (System.Convert.ToInt32 (0))); } Return ((Quantumlength ") (CUROBJ [" QuantumLength "]));} set {curobj [" quantumlength "] = value; if ((iSemBedded == false) && (autocommitprop == true)) ) {PrivateLateBoundObject.Put ();}}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsQuantumTypeNull {get {if ((curObj [ "QuantumType"] == null)) {return true;} else {return false;}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description (@ "QuantumType attribute specifies the use of fixed or variable length span .Windows NT 4.0 workstation / Windows 2000 when using the default Variable length range, the range of the front desk application is long than the background application. The fixed length range is used when the Windows NT server defaults. The range is an execution time unit, before switching to another application, allow scheduler Specify it to an application. For applications with equal priority, the kernel program seizes it when a thread runs, and moves it to the end of the queue. On different Windows platforms, the actual length of the thread range will vary. Only for Windows NT / Windows 2000. The value of this attribute is as follows: 0 = UNKOWN - Range type unknown, 1 = FIXED - Range length fixed, 2 = variable - range length variable.

")] [TypeConverter (typeof (WMIValueTypeConverter))] public QuantumTypeValues ​​QuantumType {get {if ((curObj [" QuantumType "] == null)) {return ((QuantumTypeValues) (System.Convert.ToInt32 (0))); } Return ((QuantumTypevalues) (CUROBJ ["QuantumType"]));} set {curobj ["quantumType"] = value; if ((iSembedded == false) && (autocommitprop == true)) ) {PrivateLateBoundObject.Put ();}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "RegisteredUser attribute represents the operating system of the registered user name ./n example: Jane Doe")] public string RegisteredUser {get {return ((string) (curObj [ "RegisteredUser"]));}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "SerialNumber SEQ ID attribute specifies an operating system product No./N, for example, 10497-OEM-0031416-71674. ")] public string serialnumber {get {return ((string) (Curobj [" serialnumber ");}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsServicePackMajorVersionNull {get {if ((curObj [ "ServicePackMajorVersion"] == null)) {return true;} else {return false;}}} [Browsable ( True)] [DesignerSerizationVisibility.hidden] [Description ("ServicePackmajorVersion property represents the main version number of the service package installed on the computer system. This is zero if there is no service pack installed. ServicePackmajorve " " RSI is valid only on the computer running on Windows 2000 or update version (otherwise).

")] [TypeConverter (typeof (WMIValueTypeConverter))] public System.UInt16 ServicePackMajorVersion {get {if ((curObj [" ServicePackMajorVersion "] == null)) {return System.Convert.ToUInt16 (0);} return ((System .UInt16) (curObj [ "ServicePackMajorVersion"]));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsServicePackMinorVersionNull {get {if ((curObj [ "ServicePackMinorVersion"] == null)) { return true;} else {return false;}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "ServicePackMinorVersion attribute indicates minor version number of the service pack is installed on the computer system is not installed. Service pack, this is zero .servicePackmajorve " " RSI is valid only on the computer running on Windows 2000 or update version (otherwise). ") [TypeConverter (TypeConverter)] public system.uint16 servicePackMinorVersion { Get {IF ((Curobj ["ServicePackMINORVERSION"] == null) { return System.Convert.ToUInt16 (0);} return ((System.UInt16) (curObj [ "ServicePackMinorVersion"]));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsSizeStoredInPagingFilesNull {get { if ((curObj [ "SizeStoredInPagingFiles"] == null)) {return true;} else {return false;}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "operating system can be stored in The total number of KB in the page file. Note that this number does not represent the actual physical size of the page file on the disk. 0 Indicates no page files.

")] [TypeConverter (typeof (WMIValueTypeConverter))] public System.UInt64 SizeStoredInPagingFiles {get {if ((curObj [" SizeStoredInPagingFiles "] == null)) {return System.Convert.ToUInt64 (0);} return ((System .UInt64) (curObj [ "SizeStoredInPagingFiles"]));}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "status attribute object representing the current state of the string and define different operations. Non-operating status. Operation status is "OK", "degraded" and "foreseeable fault". "Preview Fault" indicates that a component may run normal " " but foresee will soon fail. Hard drive. You can specify a non-operating state. These states are "errors", "start", "stop", "service". The latter "service" can be used for disk mirroring, " " to reload the user permissions list, or other management jobs. Not All such jobs are online; however, the managed components are not "determination" nor any other state. ")] Public string status {get {return ((string));}} [ Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsSuiteMaskNull {get {if ((curObj [ "SuiteMask"] == null)) {return true;} else {return false;}}} [Browsab Le (True)] [DesignerSerizationVisibility.hidden] [Description (@ "suitemask property represents a set of bits flags, identify a set of products on your system.

This number can be one of the following values: 0 - Small Business 1 - Enterprise 2 - BackOffice 3 - Communications 4 - Terminal 5 - Smallbusiness Restricted 6 - Embedded NT 7 - Data Center 8 - Singe User 9 - Personal 10 - Blade 30 - NT Work Station 31 - NT Server ")] [TypeConverter (typeof (WMIValueTypeConverter))] public SuiteMaskValues ​​SuiteMask {get {if ((curObj [" SuiteMask "] == null)) {return ((SuiteMaskValues) (System.Convert .ToInt32 (0)));} return ((SuiteMaskValues) (Convert.ToInt32 (curObj [ "SuiteMask"])));}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "SystemDevice attribute indicates the operating system is installed physical disk partitions ")] public string SystemDevice {get {return ((string) (curObj [" SystemDevice "]));}}. [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden) ] [Description ("SystemDirectory property represents the system directory of the operating system ./n, for example: c: // windows // system32")] public string systemdirectory {get {return ((String) (curObj [ "SystemDirectory"]));}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "SystemDrive drive letter attribute contains the operating system resides.

/ N For example, C: ")] public string SystemDrive {get {return ((string) (curObj [" SystemDrive "]));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsTotalSwapSpaceSizeNull { get {if ((curObj [ "TotalSwapSpaceSize"] == null)) {return true;} else {return false;}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( "swap space total (The unit is KB). If the switching space is not distinguished by the page file, this value can be null (not specified). However, some operating system distinguish these two concepts. For example, in UNIX, from " " by " " The page list is reduced and the process can be "changed". ")] [TypeConverter (TypeConverter)] public system.uint64 totalswapspacesize {get {ix ((Curobj [" TotalswapspaceSize " ] == null)) {return System.Convert.ToUInt64 (0);} return ((System.UInt64) (curObj [ "TotalSwapSpaceSize"]));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden) ] Public bool IsTotalVirtualMemorySizeNull {get {if ((curObj [ "TotalVirtualMemorySize"] == null)) {return true;} else {return false;}}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description ( " Virtual memory (in KB). For example, this can be calculated by adding the total amount of RAM to the page space (ie, the amount of memory and attributes SIZESTOREDINPAGINGFILES " " in the computer system).

")] [TypeConverter (typeof (WMIValueTypeConverter))] public System.UInt64 TotalVirtualMemorySize {get {if ((curObj [" TotalVirtualMemorySize "] == null)) {return System.Convert.ToUInt64 (0);} return ((System .UInt64) (curObj [ "TotalVirtualMemorySize"]));}} [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public bool IsTotalVisibleMemorySizeNull {get {if ((curObj [ "TotalVisibleMemorySize"] == null)) { Return true;}}}} [Browsable (TRUE)] [DesignerIzationVisibility.hidden] [Description ("The number of physical memory available for the operating system (" The unit is a kilobyte). This value is not Realized the number of real physical memory, butcomes the number of memory available to the operating system. ")] [TypeConverter (TypeConverter)] public system.uint64 TotalVisibleMemorySize {Get {IF ((Curobj [" TotalVisibleMemory "] = = NULL)) {Return System.convert.touint64 (0);} Return ((System.uint64) (Curobj ["Totalvis ibleMemorySize "]);}} [debowsable (true) [DesignerserializationVisibility.hidden] [Description" indicates the version of the operating system. / N, for example: 4.0 ")] public string Version {get {return ((string) (curObj [" Version "]));}} [Browsable (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [Description (" WindowsDirectory The attribute represents the Windows directory of the operating system.

/ N For example: C: // WINDOWS ")] public string WindowsDirectory {get {return ((string) (curObj [" WindowsDirectory "]));}} private bool CheckIfProperClass (System.Management.ManagementScope mgmtScope, System.Management. ManagementPath path, System.Management.ObjectGetOptions OptionsParam) {if (! ((path = null) && (System.String.Compare (path.ClassName, ManagementClassName, true, CultureInfo.InvariantCulture) == 0))) {return true; } else {return CheckIfProperClass (new System.Management.ManagementObject (mgmtScope, path, OptionsParam));!}} private bool CheckIfProperClass (System.Management.ManagementBaseObject theObj) {if (((theObj = null) && (System.String. Compare (((string) (theObj [ "__ CLASS"])), ManagementClassName, true, CultureInfo.InvariantCulture) == 0))) {return true;} else {System.Array parentClasses = ((System.Array) (theObj ["__Derivation"]); if ((parentClasses! = Null) {INT32 count = 0; for (count = 0; (count

true))) {PrivateLateBoundObject.Put ();}} private bool ShouldSerializeDebug () {if ((IsDebugNull == false)) {return true;} return false;} private void ResetDescription () {curObj [ "Description"] = null; if (((isEmbedded == false) && (AutoCommitProp == true))) {PrivateLateBoundObject.Put ();}} private bool ShouldSerializeDistributed () {if ((IsDistributedNull == false)) {return true;} return false;} private bool ShouldSerializeEncryptionLevel () {if ((IsEncryptionLevelNull == false)) {return true;} return false;} private bool ShouldSerializeForegroundApplicationBoost () {if ((IsForegroundApplicationBoostNull == false)) {return true;} return false; } Private void resetForeGroupPlicationBoost () {curobj ["ForegroundApplicationBoost"] = null; if ((iSembedded == false) && (autocmitprop == true)) {PrivateLateBoundob ject.Put ();}} private bool ShouldSerializeFreePhysicalMemory () {if ((IsFreePhysicalMemoryNull == false)) {return true;} return false;} private bool ShouldSerializeFreeSpaceInPagingFiles () {if ((IsFreeSpaceInPagingFilesNull == false)) {return true ;} return false;} private bool ShouldSerializeFreeVirtualMemory () {if ((IsFreeVirtualMemoryNull == false)) {return true;} return false;} // convert the given date and time format to System.DateTime the object DMTF.

static System.DateTime ToDateTime (string dmtfDate) {int year = System.DateTime.MinValue.Year; int month = System.DateTime.MinValue.Month; int day = System.DateTime.MinValue.Day; int hour = System.DateTime. MinValue.Hour; int minute = System.DateTime.MinValue.Minute; int second = System.DateTime.MinValue.Second; long ticks = 0; string dmtf = dmtfDate; System.DateTime datetime = System.DateTime.MinValue; string tempString = System.String.Empty; if ((dmtf == null)) {throw new System.ArgumentOutOfRangeException ();} if ((dmtf.Length == 0)) {throw new System.ArgumentOutOfRangeException ();} if ((dmtf .Length! = 25)) {throw new system.ArgumentOutofrangeException ();} try {tempstring = DMTF.SUBSTRING (0, 4); if (("****"! = Tempstring) {year = system.int32 .PARSTRING = DMTF.SUBSTRING (4, 2); if (("**"! = Tempstring)) {Month = system.int32.parse (Tempstring);} Tempstring = DMTF .Substring (6, 2); if ("**"! = Tempstring)) {day = system.int32.parse (tempstring);} tempstring = dmtf.substring (8, 2); if (("** "! = Tempstring)) {hours = system.int32.parse (Tempstring);} Tempstring = DMTF.SUBSTRING (10, 2); if ((" ** "! = tempstring)) {Minute = system.int32.parse (Tempstring); Tempstring = dmtf.substring (12, 2); if (("**"! = tempstring)) {second = system.int32.parse (Tempstring);} Tempstring = DMTF.SUBSTRING (15, 6 ); If (("******"! =

Tempstring)) {ticks = (system.int64.parse (tympstring) * (system.timespan.tickspermillisecond / 1000));} IF ((((((((((((("<0) || (MONTH <0)) || (DAY <0)) || (Hour <0)) || (Minute <0)) || (Minute <0)) || (Second <0)) || (Ticks <0))) { throw new System.ArgumentOutOfRangeException ();}} catch (System.Exception e) {e = e; throw new System.ArgumentOutOfRangeException ();} datetime = new System.DateTime (year, month, day, hour, minute, second, 0); datetime = datetime.AddTicks (ticks); System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset (datetime); int UTCOffset = 0; long OffsetToBeAdjusted = 0; long OffsetMins = (tickOffset.Ticks / System.TimeSpan. TEMPSPERMINUTE); tempstring = dmtf.substring (22, 3); if ((tempstring! = "***")) {Tempstring = dmtf.substring (21, 4); try {utcoffset = system.int32.parse (Tempstring } Catch (System.exception E) {E = e; throw new System.ArgumentOutOfRangeException ();} OffsetToBeAdjusted = (OffsetMins - UTCOffset); datetime = datetime.AddMinutes (OffsetToBeAdjusted);} return datetime;} // the given object into a DMTF Date System.DateTime Time format.

static string ToDmtfDateTime (System.DateTime date) {string utcString = System.String.Empty; System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset (date); long OffsetMins = (tickOffset.Ticks / System.TimeSpan.TicksPerMinute); IF ((system.math.abs (offsetmins)> 999)) {date = date.touniversaltime (); utstring = " 000;} else {if ((tickoffset.ticks> = 0) {uTCString = (" " ((Tickoffset.ticksPerminute)). TOSTRING (). Padleft (3, '0'));} else {string straTemp = offsetmins.tostring (); utcstring = (" - " Strtemp.substring (1, (Strtemp.Length - 1))). Padleft (3, '0'));}} String DMTFDateTime = Date.Year.toString (). Padleft (4, '0'); DMTFDateTime = DMTFDateTime Date.Month.toString (). Padleft (2, '0')); DMTFDateTime = (DMTFDateTime Date.day.toTString (). Padleft (2, '0')); DMTFDateTime = (DMTFDateTime Date. Hour.toString (). Padleft (2, '0')); dmtfdatetime = (DMTFDateTime Date.minute.tos TRING (). Padleft (2, '0')); DMTFDateTime = (DMTFDateTime Date.second.toTString (). Padleft (2, '0')); DMTFDateTime = (DMTFDateTime "); system.datetime DTTEMP = New System.datetime (Date.year, Date.Month, Date.day, Date. Hour, Date.minute, Date.second, 0); Long Microsec = ((Date.Ticks - DTTEMP.TICKS) * 1000 ) / System.timespan.tickspermillisecond; string string strMicrosec = microsec.toString (); if (strMicRosec.length> 6)) {strMicRosec = strmicrosec.substring (0, 6);} DMTFDateTime =

(DmtfDateTime strMicrosec.PadLeft (6, '0')); dmtfDateTime = (dmtfDateTime utcString); return dmtfDateTime;} private bool ShouldSerializeInstallDate () {if ((IsInstallDateNull == false)) {return true;} return false; } private bool ShouldSerializeLargeSystemCache () {if ((IsLargeSystemCacheNull == false)) {return true;} return false;} private bool ShouldSerializeLastBootUpTime () {if ((IsLastBootUpTimeNull == false)) {return true;} return false;} private bool ShouldSerializeLocalDateTime () {if ((IsLocalDateTimeNull == false)) {return true;} return false;} private bool ShouldSerializeMaxNumberOfProcesses () {if ((IsMaxNumberOfProcessesNull == false)) {return true;} return false;} private bool ShouldSerializeMaxProcessMemorySize () {If (ismaxProcessMemorySizenull == false)) {return true;} return false;} private bool ShouldSerializeNumberOfLicensedUsers () {if ((IsNumberOfLicensedUsersNull == false)) {return true;} return false;} private bool ShouldSerializeNumberOfProcesses () {if ((IsNumberOfProcessesNull == false)) {return true;} return false;} private bool ShouldSerializeNumberOfUsers () {if ((IsNumberOfUsersNull == false)) {return true;} return false;} private bool ShouldSerializeOSLanguage () {if ((IsOSLanguageNull == false)) {return true;} return false;} private bool ShouldSerializeOSProductSuite () {IF (iSOSproductsuitenull =

= False)) {return true;} return false;} private bool ShouldSerializeOSType () {if ((IsOSTypeNull == false)) {return true;} return false;} private bool ShouldSerializePrimary () {if ((IsPrimaryNull == false )) {return true;} return false;} private bool ShouldSerializeProductType () {if ((IsProductTypeNull == false)) {return true;} return false;} private bool ShouldSerializeQuantumLength () {if ((IsQuantumLengthNull == false)) {return true;} return false;} private void ResetQuantumLength () {curObj [ "QuantumLength"] = null; if (((isEmbedded == false) && (AutoCommitProp == true))) {PrivateLateBoundObject.Put ();} } private bool ShouldSerializeQuantumType () {if ((IsQuantumTypeNull == false)) {return true;} return false;} private void ResetQuantumType () {curObj [ "QuantumType"] = null; if (((isEmbedded == false) && (AutoCommitProp == true))) {PrivateLateBoundObject.Put ();}} private bool ShouldSerializeServicePackMajorVersion () {if ((IsServicePackMajorVersionNull == false)) {return true;} return false;} private bool ShouldSerializeServicePackMinorVersion ( ) {if ((IsServicePackMinorVersionNull == false)) {return true;} return false;} private bool ShouldSerializeSizeStoredInPagingFiles () {if ((IsSizeStoredInPagingFilesNull == false)) {return true;} return false;

} Private bool ShouldSerializeSuiteMask () {if ((IsSuiteMaskNull == false)) {return true;} return false;} private bool ShouldSerializeTotalSwapSpaceSize () {if ((IsTotalSwapSpaceSizeNull == false)) {return true;} return false;} private bool ShouldSerializeTotalVirtualMemorySize () {if ((IsTotalVirtualMemorySizeNull == false)) {return true;} return false;} private bool ShouldSerializeTotalVisibleMemorySize () {if ((IsTotalVisibleMemorySizeNull == false)) {return true;} return false;} [Browsable ( true)] public void CommitObject () {if ((isEmbedded == false)) {PrivateLateBoundObject.Put ();}} private static string ConstructPath (string keyName) {string strPath = "ROOT // CIMV2: Win32_OperatingSystem"; strPath = (StrPath (".Name =" ("/" ")))))))))))))))))); return strpath;} // In enumerating the different overloaded GetInstances () Help in the WMI class instance .

public static OperatingSystemCollection GetInstances () {return GetInstances (((System.Management.ManagementScope) (null)), ((System.Management.EnumerationOptions) (null)));} public static OperatingSystemCollection GetInstances (string condition) {return GetInstances ( null, condition, null);} public static OperatingSystemCollection GetInstances (System.String [] selectedProperties) {return GetInstances (null, null, selectedProperties);} public static OperatingSystemCollection GetInstances (string condition, System.String [] selectedProperties) {return GetInstances (null, condition, selectedProperties);} public static OperatingSystemCollection GetInstances (System.Management.ManagementScope mgmtScope, System.Management.EnumerationOptions enumOptions) {if ((mgmtScope == null)) {if ((statMgmtScope == null)) {mgmtScope = new system.management.managementscope (); mgmtscope.path.namespacepath = "root // CIMv2"; else {mgmtScope = statMgmtScope;}} System.Management.ManagementPath pathObj = new System.Management.ManagementPath (); pathObj.ClassName = "Win32_OperatingSystem"; pathObj.NamespacePath = "root // CIMV2"; System.Management.ManagementClass clsObject = new System.Management.ManagementClass (mgmtScope, pathObj, null); if ((enumOptions == null)) {enumOptions = new System.Management.EnumerationOptions (); enumOptions.EnsureLocatable = true;} return new OperatingSystemCollection (clsObject.GetInstances ( ENUMOPTIONS);

} Public static OperatingSystemCollection GetInstances (System.Management.ManagementScope mgmtScope, string condition) {return GetInstances (mgmtScope, condition, null);} public static OperatingSystemCollection GetInstances (System.Management.ManagementScope mgmtScope, System.String [] selectedProperties) {return GetInstances (mgmtScope, null, selectedProperties);} public static OperatingSystemCollection GetInstances (System.Management.ManagementScope mgmtScope, string condition, System.String [] selectedProperties) {if ((mgmtScope == null)) {if ((statMgmtScope == null) ) {mgmtScope = new System.Management.ManagementScope (); mgmtScope.Path.NamespacePath = "root // CIMV2";} else {mgmtScope = statMgmtScope;}} System.Management.ManagementObjectSearcher ObjectSearcher = new System.Management.ManagementObjectSearcher (mgmtScope , New SelectQuery ("Win32_OperatingSystem", Condition, SELECTEDPROPERTIES); System .Management.EnumerationOptions enumOptions = new System.Management.EnumerationOptions (); enumOptions.EnsureLocatable = true; ObjectSearcher.Options = enumOptions; return new OperatingSystemCollection (ObjectSearcher.Get ());} [Browsable (true)] public static OperatingSystem CreateInstance ( ) {System.Management.ManagementScope mgmtScope = null; if ((statMgmtScope == null)) {mgmtScope = new System.Management.ManagementScope (); mgmtScope.Path.NamespacePath = CreatedWmiNamespace;} else {mgmtScope = statMgmtScope;} System. Management.ManagementPath mgmtpath =

new System.Management.ManagementPath (CreatedClassName); return new OperatingSystem (new System.Management.ManagementClass (mgmtScope, mgmtPath, null) .CreateInstance ());} [Browsable (true)] public void Delete () {PrivateLateBoundObject.Delete ( );} public System.UInt32 Reboot () {if ((isEmbedded == false)) {System.Management.ManagementBaseObject inParams = null; bool EnablePrivileges = PrivateLateBoundObject.Scope.Options.EnablePrivileges; PrivateLateBoundObject.Scope.Options.EnablePrivileges = true ; System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod ( "Reboot", inParams, null); PrivateLateBoundObject.Scope.Options.EnablePrivileges = EnablePrivileges; return System.Convert.ToUInt32 (outParams.Properties [ "ReturnValue"] Value.); } Else {return system.convert.touint32 (0);}} public system.uint32 setDatetime (system.datetime localdatetime) {if (iSembedded == false) {system. Management.ManagementBaseObject inParams = null; bool EnablePrivileges = PrivateLateBoundObject.Scope.Options.EnablePrivileges; PrivateLateBoundObject.Scope.Options.EnablePrivileges = true; inParams = PrivateLateBoundObject.GetMethodParameters ( "SetDateTime"); inParams [ "LocalDateTime"] = ToDmtfDateTime ((( System.DateTime) (LocalDateTime))); System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod ( "SetDateTime", inParams, null); PrivateLateBoundObject.Scope.Options.EnablePrivileges = EnablePrivileges; return System.Convert.ToUInt32 (outParams.Properties ["ReturnValue"]. Value);

} Else {return System.Convert.ToUInt32 (0);}} public System.UInt32 Shutdown () {if ((isEmbedded == false)) {System.Management.ManagementBaseObject inParams = null; bool EnablePrivileges = PrivateLateBoundObject.Scope.Options .EnablePrivileges; PrivateLateBoundObject.Scope.Options.EnablePrivileges = true; System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod ( "Shutdown", inParams, null); PrivateLateBoundObject.Scope.Options.EnablePrivileges = EnablePrivileges; return System.Convert.ToUInt32 ( outParams.Properties [ "ReturnValue"] Value);.} else {return System.Convert.ToUInt32 (0);}} public System.UInt32 Win32Shutdown (int Flags, int Reserved) {if ((isEmbedded == false)) { System.Management.ManagementBaseObject inParams = null; bool EnablePrivileges = PrivateLateBoundObject.Scope.Options.EnablePrivileges; PrivateLateBoundObject.Scope.Options.EnablePrivileges = true; inPar ams = PrivateLateBoundObject.GetMethodParameters ( "Win32Shutdown"); inParams [ "Flags"] = Flags; inParams [ "Reserved"] = Reserved; System.Management.ManagementBaseObject outParams = PrivateLateBoundObject.InvokeMethod ( "Win32Shutdown", inParams, null); PrivateLateBoundObject .Scope.Options.enableprivilegegs; return system.convert.touint32 (Outparams.Properties ["ReturnValue"]. Value);} else {return system.convert.touint32 (0);

}} Public enum EncryptionLevelValues: int {Val_40_ bit, Val_128_ bits, bits of N_,} public enum ForegroundApplicationBoostValues: int {no, minimum, maximum,} public enum LargeSystemCacheValues: long {0 = application optimization, system performance optimization = 1,} public enum ockproductsuitevalues: int {small_business = 1, Enterprise = 2, BackOffice = 4, Communication server = 8, terminal server = 16, small_business_restricted_ = 32, Embedded_NT = 64, Data_Center =

128,} public enum ostypevalues: int {unknown, other, Macos, Attunix, DGUX, DECNT, DIGITAL_UNIX, OpenVMS, HPUX, AIX, MVS, OS400, OS_2, JavaVM, MSDOS, Win3x, Win95, Win98, WinNT, Wince, NCR3000 , NetWare, OSF, DC_OS, Reliant_UNIX, SCO_UnixWare, SCO_OpenServer, Sequent, IRIX, Solaris, SunOS, U6000, ASERIES, TandemNSK, TandemNT, BS2000, _UNIX LINUX, Lynx, XENIX, VM_ESA, interactive, BSDUNIX, FreeBSD, NetBSD, GNU_Hurd, OS9, MACH_Kernel, Inferno, QNX, EPOC, IxWorks, VxWorks, MiNT, BeOS, HP_MPE, NextStep, PalmPilot, Rhapsody, Windows_2000, dedicated, OS_390, VSE, TPF,} public enum ProductTypeValues: long {workstation = 1, domain controller = 2, server = 3, invalid_enum_value =

0,} public enum QuantumLengthValues: int {unknown, click, double click,} public enum QuantumTypeValues: int {unknown, fixed, variable,} public enum SuiteMaskValues: int {Small_Business = 1, Enterprise = 2, BackOffice = 4, communications = 8, terminal = 16, smallbusiness_restricted = 32, embedded_nt = 64, data_center = 128, single user = 256, person = 512, blade = 1024, nt_work_station = 2048, nt_server = 4096,} // Enumerate the enumeration of this class instance Number implementation.

public class OperatingSystemCollection: object, ICollection {private ManagementObjectCollection ObjectCollection; public OperatingSystemCollection (ManagementObjectCollection objCollection) {ObjectCollection = objCollection;} public int Count {get {return ObjectCollection.Count;}} public bool IsSynchronized {get {return ObjectCollection.IsSynchronized;}} public object SyncRoot {get {return this;}} public void CopyTo (System.Array array, int index) {ObjectCollection.CopyTo (array, index); int nCtr; for (nCtr = 0; (nCtr

}}} // null processing ValueType attributes TypeConverter public class WMIValueTypeConverter: TypeConverter {private TypeConverter baseConverter; public WMIValueTypeConverter (System.Type baseType) {baseConverter = TypeDescriptor.GetConverter (baseType);} public override bool CanConvertFrom (System.ComponentModel .ITypeDescriptorContext context, System.Type srcType) {return baseConverter.CanConvertFrom (context, srcType);} public override bool CanConvertTo (System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType) {return baseConverter.CanConvertTo (context, destinationType);} public override object ConvertFrom (System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {return baseConverter.ConvertFrom (context, culture, value);} public override object CreateInstance (System.ComponentModel.ITypeD escriptorContext context, System.Collections.IDictionary dictionary) {return baseConverter.CreateInstance (context, dictionary);} public override bool GetCreateInstanceSupported (System.ComponentModel.ITypeDescriptorContext context) {return baseConverter.GetCreateInstanceSupported (context);} public override PropertyDescriptorCollection GetProperties (System .ComponentModel.ityped, Object value, system.attribute [] attributevar) {Return BaseConverter.getProperties (Context, Value, Attributevar);

} Public override bool GetPropertiesSupported (System.ComponentModel.ITypeDescriptorContext context) {return baseConverter.GetPropertiesSupported (context);} public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues ​​(System.ComponentModel.ITypeDescriptorContext context) {return baseConverter.GetStandardValues ​​(context); } public override bool GetStandardValuesExclusive (System.ComponentModel.ITypeDescriptorContext context) {return baseConverter.GetStandardValuesExclusive (context);} public override bool GetStandardValuesSupported (System.ComponentModel.ITypeDescriptorContext context) {return baseConverter.GetStandardValuesSupported (context);} public override object ConvertTo ( System.comPonentModel.ityped, System.globalization.cultureInfo Culture, Object Value, System.Type DestinationType) {IF ((Context! = NULL) { if ((context.PropertyDescriptor.ShouldSerializeValue (context.Instance) == false)) {return "";}} return baseConverter.ConvertTo (context, culture, value, destinationType);}} // WMI classes represented embedded system properties .

[TypeConverter (typeof (System.ComponentModel.ExpandableObjectConverter))] public class ManagementSystemProperties {private System.Management.ManagementBaseObject PrivateLateBoundObject; public ManagementSystemProperties (System.Management.ManagementBaseObject ManagedObject) {PrivateLateBoundObject = ManagedObject;} [Browsable (true)] public int GENUS {GET {Return ((int));}} [browsable (true)] public string class {get {return (string) ("__) (" __ class ");}} [ Browsable (true)] public string SUPERCLASS {get {return ((string) (PrivateLateBoundObject [ "__ SUPERCLASS"]));}} [Browsable (true)] public string DYNASTY {get {return ((string) (PrivateLateBoundObject [ "__ DYNASTY "]));}} [Browsable (true)] public string relpath {get { return ((string) (PrivateLateBoundObject [ "__ RELPATH"]));}} [Browsable (true)] public int PROPERTY_COUNT {get {return ((int) (PrivateLateBoundObject [ "__ PROPERTY_COUNT"]));}} [Browsable (true )] Public string [] DERIVATION {get {return ((String []) ("__ DeriVation"));}} [browsable (true)] public string server {get {return (string) (PrivatelandBoundObject [" __Server "]);}} [browsable (true)] public string namespace {get {return ((string));

转载请注明原文地址:https://www.9cbs.com/read-112887.html

New Post(0)