Monday, 4 February 2013

Getting Operating System Information using C#



Win32_OperatingSystem: The Win32_OperatingSystem WMI class represents a Windows-based operating system installed on a computer. Any operating system that can be installed on a computer that can run a Windows-based operating system is a descendent or member of this class. Win32_OperatingSystem is a singleton class.
Name
Data type
Description
BootDevice
String
Name of the disk drive from which the Windows operating system starts
BuildNumber
String
Build number of an operating system. It can be for more precise version information than product release version numbers
BuildType
String
Type of build used for an operating system
Caption
String
Short description of the object-a one line string. The string includes the operating system version
CodeSet
String
Code page value an operating system. A code page contains a character table that an operating system uses to translate strings for different languages
CountryCode
String
Code for the country/region that an operating system uses
CSDVersion
String
NULL-terminated string that indicates the latest service pack installed on the computer.
CSName
String
Name of the computer
CurrentTimeZone
Sint16
Number, in minutes, an operating system is offset from GMT
Description
String
Description of the Windows operating system
Distributed
Boolean
If True, the operating system is distributed across several computer system nodes
FreePhysicalMemory
Uint64
Number, in kilobytes, of physical memory currently unused and available
FreeSpaceInPagingFiles
Uint64
Number, in kilobytes, that can be mapped into the operating system paging files without causing any other pages to be swapped out
FreeVirtualMemory
Uint64
Number, in kilobytes, of virtual memory currently unused and available
InstallDate
Datetime
Date and time of the installation of operating system
LastBootUpTime
Datetime
Date and time the operating system was last restarted
LocalDateTime
Datetime
Current date and time
Locale
String
Language identifier used by the operating system
Manufacturer
String
Name of the operating system manufacturer
MaxNumberOfProcesses
Uint32
Maximum number of process contexts the operating system can support
MaxProcessMemorySize
Uint64
Maximum number, in kilobytes, of memory that can be allocated to a process
Name
String
Operating system instance within a computer system
NumberOfProcesses
Uint32
Number of process contexts currently loaded or running on the operating system
NumberOfUsers
Uint32
Number of user sessions for which the operating system is storing state information currently
OperatingSystemSKU
Uint32
Stock Keeping Unit(SKU) number for the operating system
Organization
String
Company name for the registered user of the operating system
OSArchitecture
String
Architecture of the operating system, as opposed to the processor
OSLanguage
String
Language version of the operating system installed
OSType
Uint16
Type of operating system
Primary
Boolean
Specifies whether this is the primary operating system
ProductType
Uint32
Additional system information
RegisteredUser
String
Name of the registered user of the operating system
SerialNumber
String
Operating system product serial identification number
ServicePackMajorVersion
Uint16
Major version number of the service pack installed on the computer system
ServicePackMinorVersion
Uint16
Minor version number of the service pack installed on the computer system
SizeStoredInPagingFiles
Uint64
Total number of kilobytes that can be stored in the operating system paging files
Status
String
Current status of the object
SystemDevice
String
Physical disk partition on which the operating system is installed
SystemDirectory
String
System directory of the operating system
SystemDrive
String
Letter of the disk drive on which the operating system resides
TotalVirtualMemorySize
Uint64
Number, in kilobytes, of virtual memory
TotalVisibleMemorySize
Uint64
Total amount, in kilobytes, of physical memory available to the operating system
Version
String
Version number of the operating system
WindowsDirectory
String
Windows directory of the operating system

CodeSet Properties:
Code
Description
874
Thai
932
Japanese
936
Chinese (Simplified) (PRC, Singapore)
949
Korean
950
Chinese (Traditional) (Taiwan, Hong Kong)
1200
Unicode (BMP of ISO 10646, UTF-16LE)
1201
Unicode (BMP of ISO 10646, UTF-16BE)
1250
Latin (Central European Languages)
1251
Cyrillic
1252
Latin (Western European Languages, replacing Code Page 850)
1253
Greek
1254
Turkish
1255
Hebrew
1256
Arabic
1257
Latin (Baltic Languages)
1258
Vietnamese
65000
Unicode (BMP of ISO 10646, UTF-7)
65001
Unicode (BMP of ISO 10646, UTF-8)

CountryCode Properties:
Code
Description
1
United States
2
Canadian-French
31
Netherlands
32
Belgium
33
France
34
Spain
36
Hungary
39
Italy
41
Switzerland
42
Czech Republic
42
Slovakia
44
United Kingdom
45
Denmark
46
Sweden
47
Norway
48
Poland
49
Germany
55
Brazil
61
International English
351
Portugal
358
Finland

OperatingSystemSKU Properties:
Value
Meaning
0
Undefined
1
Ultimate Edition
2
Home Basic Edition
3
Home Premium Edition
4
Enterprise Edition
5
Home Basic N Edition
6
Business Edition
7
Standard Server Edition
8
Datacenter Server Edition
9
Small Business Server Edition
10
Enterprise Server Edition
11
Starter Edition
12
Datacenter Server Core Edition
13
Standard Server Core Edition
14
Enterprise Server Core Edition
15
Enterprise Server Edition for Itanium-Based Systems
16
Business N Edition
17
Web Server Edition
18
Cluster Server Edition
19
Home Server Edition
20
Storage Express Server Edition
21
Storage Standard Server Edition
22
Storage Workgroup Server Edition
23
Storage Enterprise Server Edition
24
Server For Small Business Edition
25
Small Business Server Premium Edition

OSType Properties:
Value
Meaning
0
Unknown
1
Other
2
MACROS
3
ATTUNIX
4
DGUX
5
DECNT
6
Digital UNIX
7
OpenVMS
8
HPUX
9
AIX
10
MVS
11
OS400
12
OS/2
13
JavaVM
14
MSDOS
15
WIN3x
16
WIN95
17
WIN98
18
WINNT
19
WINCE
20
NCR3000
21
NetWare
22
OSF
23
DC/OS
24
Reliant UNIX
25
SCO UnixWare
26
SCO OpenServer
27
Sequent
28
IRIX
29
Solaris
30
SunOS
31
U6000
32
ASERIES
33
TandemNSK
34
TandemNT
35
BS2000
36
LINUX
37
Lynx
38
XENIX
39
VM/ESA
40
Interactive UNIX
41
BSDUNIX
42
FreeBSD
43
NetBSD
44
GNU Hurd
45
OS9
46
MACH Kernel
47
Inferno
48
QNX
49
EPOC
50
IxWorks
51
VxWorks
52
MiNT
53
BeOS
54
HP MPE
55
NextStep
56
PalmPilot
57
Rhapsody

OSLanguage & Locale Properties:
OSLanguage
Locale
Meaning
1078
0436
Afrikaans
1052
041c
Albanian
1025
0401
Arabic (Saudi Arabia)
2049
0801
Arabic (Iraq)
3073
0c01
Arabic (Egypt)
4097
1001
Arabic (Libya)
5121
1401
Arabic (Algeria)
6145
1801
Arabic (Morocco)
7169
1c01
Arabic (Tunisia)
8193
2001
Arabic (Oman)
9217
2401
Arabic (Yemen)
10241
2801
Arabic (Syria)
11265
2c01
Arabic (Jordon)
12289
3001
Arabic (Lebanon)
13313
3401
Arabic (Kuwait)
14337
3801
Arabic (UAE)
15361
3c01
Arabic (Bahrain)
16385
4001
Arabic (Qatar)
1067
042b
Armenian
1068
042c
Azeri (Latin)
2092
082c
Azeri (Cyrillic)
1069
042d
Basque
1059
0423
Belarusian
1093
0445
Bengali (India)
5146
141A
Bosnian (Latin)
1026
0402
Bulgarian
1027
0403
Catalan
1028
0404
Chinese (Taiwan)
2052
0804
Chinese (PRC)
3076
0c04
Chinese (Hong Kong)
4100
1004
Chinese (Singapore)
5124
1404
Chinese (Macau)
1050
041a
Croatian
4122
101A
Croatian (Bosnia Herzegovina)
1029
0405
Czech
1030
0406
Danish
1125
0465
Divehi
1043
0413
Dutch (Standard)
2067
0813
Dutch (Belgian)
1033
0409
English (United States)
2057
0809
English (United Kingdom)
3081
0c09
English (Australian)
4105
1009
English (Canadian)
5129
1409
English (New Zealand)
6153
1809
English (Ireland)
7177
1c09
English (South Africa)
8201
2009
English (Jamaica)
9225
2409
English (Caribbean)
10249
2809
English (Belize)
11273
2c09
English (Trinidad)
12297
3009
English (Zimbabwe)
13321
3409
English (Philippines)
1061
0425
Estonian
1080
0438
Faeroese
1065
0429
Farsi
1035
040b
Finnish
1036
040c
French (Standard)
2060
080c
French (Belgian)
3084
0c0c
French (Canadian)
4108
100c
French (Swiss)
5132
140c
French (Luxembourg)
6156
180c
French (Monaco)
1079
0437
Georgian
1110
0456
Galician
1031
0407
German (Standard)
2055
0807
German (Swiss)
3079
0c07
German (Austrian)
4103
1007
German (Luxembourg)
5127
1407
German (Liechtenstein)
1032
0408
Greek
1095
0447
Gujarati
1037
040d
Hebrew
1081
0439
Hindi
1038
040e
Hungarian
1039
040f
Icelandic
1057
0421
Indonesian
1040
0410
Italian (Standard)
2064
0810
Italian (Swiss)
1041
0411
Japanese
1099
044b
Kannada
1087
043f
Kazakh
1111
0457
Konkani
1042
0412
Korean
1088
0440
Kyrgyz
1062
0426
Latvian
1063
0427
Lithuanian
1071
042f
Macedonian
1086
043e
Malay (Malaysia)
2110
083e
Malay (Brunei Darussalam)
1100
044c
Malayalam
1082
043a
Maltese
1153
0481
Maori
1102
044e
Marathi
1104
0450
Mongolian
1044
0414
Norwegian (Bokmal)
2068
0814
Norwegian (Nynorsk)
1045
0415
Polish
1046
0416
Portuguese (Brazilian)
2070
0816
Portuguese (Standard)
1094
0446
Punjabi
1131
046b
Quechua (Bolivia)
2155
086b
Quechua (Ecuador)
3179
0c6b
Quechua (Peru)
1048
0418
Romanian
1049
0419
Russian
9275
243b
Sami (Inari)
4155
103b
Sami (Lule Norway)
5179
143b
Sami (Lule Sweden)
3131
0c3b
Sami (Northern Finland)
1083
043b
Sami (Northern Norway)
2107
083b
Sami (Northern Sweden)
8251
203b
Sami (Skolt)
6203
183b
Sami (Southern Norway)
7227
1c3b
Sami (Southern Sweden)
1103
044f
Sanskrit
2074
081a
Serbian (Latin)
6170
181a
Serbian (Latin Bosnia Herzegovina)
3098
0c1a
Serbian (Cyrillic)
7194
1c1a
Serbian (Cyrillic Bosnia Herzegovina)
1051
041b
Slovak
1060
0424
Slovenian
1034
040a
Spanish (Traditional Sort)
2058
080a
Spanish (Mexican)
3082
0c0a
Spanish (Modern Sort)
4106
100a
Spanish (Guatemala)
5130
140a
Spanish (Costa Rica)
6154
180a
Spanish (Panama)
7178
1c0a
Spanish (Dominican Republic)
8202
200a
Spanish (Venezuela)
9226
240a
Spanish (Colombia)
10250
280a
Spanish (Peru)
11274
2c0a
Spanish (Argentina)
12298
300a
Spanish (Ecuador)
13322
340a
Spanish (Chile)
14346
380a
Spanish (Uruguay)
15370
3c0a
Spanish (Paraguay)
16394
400a
Spanish (Bolivia)
17418
440a
Spanish (El Salvador)
18442
480a
Spanish (Honduras)
19466
4c0a
Spanish (Nicaragua)
20490
500a
Spanish (Puerto Rico)
1089
0441
Swahili
1053
041d
Swedish
2077
081d
Swedish (Finland)
1114
045a
Syriac
1097
0449
Tamil
1092
0444
Tatar
1098
044a
Telugu
1054
041e
Thai
1074
0432
Tswana
1058
0422
Ukrainian
1055
041f
Turkish
1056
0420
Urdu
1091
0443
Uzbek (Latin)
2115
0843
Uzbek (Cyrillic)
1066
042a
Vietnamese
1106
0452
Welsh
1076
0434
Xhosa
1077
0435
Zulu

ProductType Properties:
Value
Meaning
1
Work Station
2
Domain Controller
3
Server

Status Properties:
·         OK
·         Error
·         Degraded
·         Unknown
·         Pred Fail
·         Starting
·         Stopping
·         Service
Step 1: Create New Project (Console Application)
Step 2: Add “System.Management” namespace.
Step 3: Add a new “Class” file (say, OSInfo.cs)
Step 4: Write the following code for “OSInfo.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Management;

namespace OS
{
    static public class OSInfo
    {
        private static ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_OperatingSystem");

        static public string BootDevice
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["BootDevice"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string BuildNumber
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["BuildNumber"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string BuildType
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["BuildType"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string Caption
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["Caption"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string CodeSet
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return GetCodeSetName(queryObj["CodeSet"].ToString());
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string CountryCode
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return GetCountryCodeName(queryObj["CountryCode"].ToString());
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string CSDVersion
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return "" + queryObj["CSDVersion"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string CSName
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["CSName"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string CurrentTimeZone
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return ConvertToTimeZone(queryObj["CurrentTimeZone"].ToString());
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string Description
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["Description"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public bool Distributed
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        if (queryObj["Distributed"].ToString() == "True")
                            return true;
                        else
                            return false;
                    }
                    return false;
                }
                catch (Exception e)
                {
                    return false;
                }
            }
        }

        static public long FreePhysicalMemory
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return long.Parse(queryObj["FreePhysicalMemory"].ToString());
                    }
                    return 0;
                }
                catch (Exception e)
                {
                    return 0;
                }
            }
        }

        static public long FreeSpaceInPagingFiles
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return long.Parse(queryObj["FreeSpaceInPagingFiles"].ToString());
                    }
                    return 0;
                }
                catch (Exception e)
                {
                    return 0;
                }
            }
        }

        static public long FreeVirtualMemory
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return long.Parse(queryObj["FreeVirtualMemory"].ToString());
                    }
                    return 0;
                }
                catch (Exception e)
                {
                    return 0;
                }
            }
        }

        static public string InstallDate
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return ConvertToDateTime(queryObj["InstallDate"].ToString());
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string LastBootUpTime
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return ConvertToDateTime(queryObj["LastBootUpTime"].ToString());
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string LocalDateTime
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return ConvertToDateTime(queryObj["LocalDateTime"].ToString());
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string Locale
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return GetLocaleName(queryObj["Locale"].ToString());
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string Manufacturer
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["Manufacturer"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public long MaxNumberOfProcesses
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return long.Parse(queryObj["MaxNumberOfProcesses"].ToString());
                    }
                    return 0;
                }
                catch (Exception e)
                {
                    return 0;
                }
            }
        }

        static public long MaxProcessMemorySize
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return long.Parse(queryObj["MaxProcessMemorySize"].ToString());
                    }
                    return 0;
                }
                catch (Exception e)
                {
                    return 0;
                }
            }
        }

        static public string Name
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["Name"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public long NumberOfProcesses
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return long.Parse(queryObj["NumberOfProcesses"].ToString());
                    }
                    return 0;
                }
                catch (Exception e)
                {
                    return 0;
                }
            }
        }

        static public long NumberOfUsers
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return long.Parse(queryObj["NumberOfUsers"].ToString());
                    }
                    return 0;
                }
                catch (Exception e)
                {
                    return 0;
                }
            }
        }

        static public string OperatingSystemSKU
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return GetOperatingSystemSKUName(int.Parse(queryObj["OperatingSystemSKU"].ToString()));
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string Organization
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["Organization"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string OSArchitecture
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["OSArchitecture"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string OSLanguage
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return GetOSLanguageName(int.Parse(queryObj["OSLanguage"].ToString()));
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string OSType
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return GetOSTypeName(int.Parse(queryObj["OSType"].ToString()));
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public bool Primary
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        if (queryObj["Primary"].ToString() == "True")
                            return true;
                        else
                            return false;
                    }
                    return false;
                }
                catch (Exception e)
                {
                    return false;
                }
            }
        }

        static public string ProductType
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return GetProductTypeName(int.Parse(queryObj["ProductType"].ToString()));
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string RegisteredUser
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["RegisteredUser"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string SerialNumber
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["SerialNumber"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public long ServicePackMajorVersion
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return long.Parse(queryObj["ServicePackMajorVersion"].ToString());
                    }
                    return 0;
                }
                catch (Exception e)
                {
                    return 0;
                }
            }
        }

        static public long ServicePackMinorVersion
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return long.Parse(queryObj["ServicePackMinorVersion"].ToString());
                    }
                    return 0;
                }
                catch (Exception e)
                {
                    return 0;
                }
            }
        }

        static public long SizeStoredInPagingFiles
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return long.Parse(queryObj["SizeStoredInPagingFiles"].ToString());
                    }
                    return 0;
                }
                catch (Exception e)
                {
                    return 0;
                }
            }
        }

        static public string Status
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["Status"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string SystemDevice
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["SystemDevice"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string SystemDirectory
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["SystemDirectory"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string SystemDrive
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["SystemDrive"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public long TotalVirtualMemorySize
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return long.Parse(queryObj["TotalVirtualMemorySize"].ToString());
                    }
                    return 0;
                }
                catch (Exception e)
                {
                    return 0;
                }
            }
        }

        static public long TotalVisibleMemorySize
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return long.Parse(queryObj["TotalVisibleMemorySize"].ToString());
                    }
                    return 0;
                }
                catch (Exception e)
                {
                    return 0;
                }
            }
        }

        static public string Version
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["Version"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        static public string WindowsDirectory
        {
            get
            {
                try
                {
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        return queryObj["WindowsDirectory"].ToString();
                    }
                    return "";
                }
                catch (Exception e)
                {
                    return "";
                }
            }
        }

        private static string GetCodeSetName(string codeSet)
        {
            long lngCodeSet = long.Parse(codeSet);
            switch (lngCodeSet)
            {
                case 874: return "Thai";
                case 932: return "Japanese";
                case 936: return "Chinese (Simplified) (PRC, Singapore)";
                case 949: return "Korean";
                case 950: return "Chinese (Traditional) (Taiwan, Hong Kong)";
                case 1200: return "Unicode (BMP of ISO 10646, UTF-16LE)";
                case 1201: return "Unicode (BMP of ISO 10646, UTF-16BE)";
                case 1250: return "Latin (Central European Languages)";
                case 1251: return "Cyrillic";
                case 1252: return "Latin (Western European Languages, replacing Code Page 850)";
                case 1253: return "Greek";
                case 1254: return "Turkish";
                case 1255: return "Hebrew";
                case 1256: return "Arabic";
                case 1257: return "Latin (Baltic Languages)";
                case 1258: return "Vietnamese";
                case 65000: return "Unicode (BMP of ISO 10646, UTF-7)";
                case 65001: return "Unicode (BMP of ISO 10646, UTF-8)";
                default: return "Unknown";
            }
        }

        private static string GetCountryCodeName(string countryCode)
        {
            long lngCountryCode = long.Parse(countryCode);
            switch (lngCountryCode)
            {
                case 1: return "United States";
                case 2: return "Canadian-French";
                case 31: return "Netherlands";
                case 32: return "Belgium";
                case 33: return "France";
                case 34: return "Spain";
                case 36: return "Hungary";
                case 39: return "Italy";
                case 41: return "Switzerland";
                case 42: return "Czech Republic/Slovakia";
                case 44: return "United Kingdom";
                case 45: return "Denmark";
                case 46: return "Sweden";
                case 47: return "Norway";
                case 48: return "Poland";
                case 49: return "Germany";
                case 55: return "Brazil";
                case 61: return "International English";
                case 351: return "Portugal";
                case 358: return "Finland";
                default: return "Unknown";
            }
        }

        private static string GetLocaleName(string locale)
        {
            switch (locale)
            {
                case "0436": return "Afrikaans";
                case "041c": return "Albanian";
                case "0401": return "Arabic (Saudi Arabia)";
                case "0801": return "Arabic (Iraq)";
                case "0c01": return "Arabic (Eqypt)";
                case "1001": return "Arabic (Libya)";
                case "1401": return "Arabic (Algeria)";
                case "1801": return "Arabic (Morocco)";
                case "1c01": return "Arabic (Tunisia)";
                case "2001": return "Arabic (Oman)";
                case "2401": return "Arabic (Yemen)";
                case "2801": return "Arabic (Syria)";
                case "2c01": return "Arabic (Jordon)";
                case "3001": return "Arabic (Lebanon)";
                case "3401": return "Arabic (Kuwait)";
                case "3801": return "Arabic (UAE)";
                case "3c01": return "Arabic (Bahrain)";
                case "4001": return "Arabic (Qatar)";
                case "042b": return "Armenian";
                case "042c": return "Azeri (Latin)";
                case "082c": return "Azeri (Cyrillic)";
                case "042d": return "Basque";
                case "0423": return "Belarusian";
                case "0445": return "Bengali (India)";
                case "141A": return "Bosnian (Latin)";
                case "0402": return "Bulgarian";
                case "0403": return "Catalan";
                case "0404": return "Chinese (Taiwan)";
                case "0804": return "Chinese (PRC)";
                case "0c04": return "Chinese (Hong Kong)";
                case "1004": return "Chinese (Singapore)";
                case "1404": return "Chinese (Macau)";
                case "041a": return "Croatian";
                case "101A": return "Croatian (Bosnia Herzegovina)";
                case "0405": return "Czech";
                case "0406": return "Danish";
                case "0465": return "Divehi";
                case "0413": return "Dutch (Standard)";
                case "0813": return "Dutch (Belgian)";
                case "0409": return "English (United States)";
                case "0809": return "English (United Kingdom)";
                case "0c09": return "English (Australian)";
                case "1009": return "English (Canadian)";
                case "1409": return "English (New Zealand)";
                case "1809": return "English (Ireland)";
                case "1c09": return "English (South Africa)";
                case "2009": return "English (Jamaica)";
                case "2409": return "English (Caribbean)";
                case "2809": return "English (Belize)";
                case "2c09": return "English (Trinidad)";
                case "3009": return "English (Zimbabwe)";
                case "3409": return "English (Philippines)";
                case "0425": return "Estonian";
                case "0438": return "Faeroese";
                case "0429": return "Farsi";
                case "040b": return "Finnish";
                case "040c": return "French (Standard)";
                case "080c": return "French (Belgian)";
                case "0c0c": return "French (Canadian)";
                case "100c": return "French (Swiss)";
                case "140c": return "French (Luxembourg)";
                case "180c": return "French (Monaco)";
                case "0437": return "Georgian";
                case "0456": return "Galician";
                case "0407": return "German (Standard)";
                case "0807": return "German (Swiss)";
                case "0c07": return "German (Austrian)";
                case "1007": return "German (Luxembourg)";
                case "1407": return "German (Liechtenstein)";
                case "0408": return "Greek";
                case "0447": return "Gujarati";
                case "040d": return "Hebrew";
                case "0439": return "Hindi";
                case "040e": return "Hungarian";
                case "040f": return "Icelandic";
                case "0421": return "Indonesian";
                case "0410": return "Italian (Standard)";
                case "0810": return "Italian (Swiss)";
                case "0411": return "Japanese";
                case "044b": return "Kannada";
                case "043f": return "Kazakh";
                case "0457": return "Konkani";
                case "0412": return "Korean";
                case "0440": return "Kyrgyz";
                case "0426": return "Latvian";
                case "0427": return "Lithuanian";
                case "042f": return "Macedonian";
                case "043e": return "Malay (Malaysia)";
                case "083e": return "Malay (Brunei Darussalam)";
                case "044c": return "Malayalam";
                case "043a": return "Maltese";
                case "0481": return "Maori";
                case "044e": return "Marathi";
                case "0450": return "Mongolian";
                case "0414": return "Norwegian (Bokmal)";
                case "0814": return "Norwegian (Nynorsk)";
                case "0415": return "Polish";
                case "0416": return "Portuguese (Brazilian)";
                case "0816": return "Portuguese (Standard)";
                case "0446": return "Punjabi";
                case "046b": return "Quechua (Bolivia)";
                case "086b": return "Quechua (Ecuador)";
                case "0c6b": return "Quechua (Peru)";
                case "0418": return "Romanian";
                case "0419": return "Russian";
                case "243b": return "Sami (Inari)";
                case "103b": return "Sami (Lule Norway)";
                case "143b": return "Sami (Lule Sweden)";
                case "0c3b": return "Sami (Northern Finland)";
                case "043b": return "Sami (Northern Norway)";
                case "083b": return "Sami (Northern Sweden)";
                case "203b": return "Sami (Skolt)";
                case "183b": return "Sami (Southern Norway)";
                case "1c3b": return "Sami (Southern Sweden)";
                case "044f": return "Sanskrit";
                case "081a": return "Serbian (Latin)";
                case "181a": return "Serbian (Latin Bosnia Herzegovina)";
                case "0c1a": return "Serbian (Cyrillic)";
                case "1c1a": return "Serbian (Cyrillic Bosnia Herzegovina)";
                case "041b": return "Slovak";
                case "0424": return "Slovenian";
                case "040a": return "Spanish (Traditional Sort)";
                case "080a": return "Spanish (Mexican)";
                case "0c0a": return "Spanish (Modern Sort)";
                case "100a": return "Spanish (Gautemala)";
                case "140a": return "Spanish (Costa Rica)";
                case "180a": return "Spanish (Panama)";
                case "1c0a": return "Spanish (Dominican Republic)";
                case "200a": return "Spanish (Venezuela)";
                case "240a": return "Spanish (Colombia)";
                case "280a": return "Spanish (Peru)";
                case "2c0a": return "Spanish (Argentina)";
                case "300a": return "Spanish (Ecuador)";
                case "340a": return "Spanish (Chile)";
                case "380a": return "Spanish (Uruguay)";
                case "3c0a": return "Spanish (Paraguay)";
                case "400a": return "Spanish (Bolivia)";
                case "440a": return "Spanish (El Salvador)";
                case "480a": return "Spanish (Honduras)";
                case "4c0a": return "Spanish (Nicaragua)";
                case "500a": return "Spanish (Puerto Rico)";
                case "0441": return "Swahili";
                case "041d": return "Swedish";
                case "081d": return "Swedish (Finland)";
                case "045a": return "Syriac";
                case "0449": return "Tamil";
                case "0444": return "Tatar";
                case "044a": return "Telugu";
                case "041e": return "Thai";
                case "0432": return "Tswana";
                case "0422": return "Ukrainian";
                case "041f": return "Turkish";
                case "0420": return "Urdu";
                case "0443": return "Uzbek (Latin)";
                case "0843": return "Uzbek (Cyrillic)";
                case "042a": return "Vietnamese";
                case "0452": return "Welsh";
                case "0434": return "Xhosa";
                case "0435": return "Zulu";
                default: return "Unknown";
            }
        }

        private static string GetOSLanguageName(int language)
        {
            switch (language)
            {
                case 1078: return "Afrikaans";
                case 1052: return "Albanian";
                case 1025: return "Arabic (Saudi Arabia)";
                case 2049: return "Arabic (Iraq)";
                case 3073: return "Arabic (Eqypt)";
                case 4097: return "Arabic (Libya)";
                case 5121: return "Arabic (Algeria)";
                case 6145: return "Arabic (Morocco)";
                case 7169: return "Arabic (Tunisia)";
                case 8193: return "Arabic (Oman)";
                case 9217: return "Arabic (Yemen)";
                case 10241: return "Arabic (Syria)";
                case 11265: return "Arabic (Jordon)";
                case 12289: return "Arabic (Lebanon)";
                case 13313: return "Arabic (Kuwait)";
                case 14337: return "Arabic (UAE)";
                case 15361: return "Arabic (Bahrain)";
                case 16385: return "Arabic (Qatar)";
                case 1067: return "Armenian";
                case 1068: return "Azeri (Latin)";
                case 2092: return "Azeri (Cyrillic)";
                case 1069: return "Basque";
                case 1059: return "Belarusian";
                case 1093: return "Bengali (India)";
                case 5146: return "Bosnian (Latin)";
                case 1026: return "Bulgarian";
                case 1027: return "Catalan";
                case 1028: return "Chinese (Taiwan)";
                case 2052: return "Chinese (PRC)";
                case 3076: return "Chinese (Hong Kong)";
                case 4100: return "Chinese (Singapore)";
                case 5124: return "Chinese (Macau)";
                case 1050: return "Croatian";
                case 4122: return "Croatian (Bosnia Herzegovina)";
                case 1029: return "Czech";
                case 1030: return "Danish";
                case 1125: return "Divehi";
                case 1043: return "Dutch (Standard)";
                case 2067: return "Dutch (Belgian)";
                case 1033: return "English (United States)";
                case 2057: return "English (United Kingdom)";
                case 3081: return "English (Australian)";
                case 4105: return "English (Canadian)";
                case 5129: return "English (New Zealand)";
                case 6153: return "English (Ireland)";
                case 7177: return "English (South Africa)";
                case 8201: return "English (Jamaica)";
                case 9225: return "English (Caribbean)";
                case 10249: return "English (Belize)";
                case 11273: return "English (Trinidad)";
                case 12297: return "English (Zimbabwe)";
                case 13321: return "English (Philippines)";
                case 1061: return "Estonian";
                case 1080: return "Faeroese";
                case 1065: return "Farsi";
                case 1035: return "Finnish";
                case 1036: return "French (Standard)";
                case 2060: return "French (Belgian)";
                case 3084: return "French (Canadian)";
                case 4108: return "French (Swiss)";
                case 5132: return "French (Luxembourg)";
                case 6156: return "French (Monaco)";
                case 1079: return "Georgian";
                case 1110: return "Galician";
                case 1031: return "German (Standard)";
                case 2055: return "German (Swiss)";
                case 3079: return "German (Austrian)";
                case 4103: return "German (Luxembourg)";
                case 5127: return "German (Liechtenstein)";
                case 1032: return "Greek";
                case 1095: return "Gujarati";
                case 1037: return "Hebrew";
                case 1081: return "Hindi";
                case 1038: return "Hungarian";
                case 1039: return "Icelandic";
                case 1057: return "Indonesian";
                case 1040: return "Italian (Standard)";
                case 2064: return "Italian (Swiss)";
                case 1041: return "Japanese";
                case 1099: return "Kannada";
                case 1087: return "Kazakh";
                case 1111: return "Konkani";
                case 1042: return "Korean";
                case 1088: return "Kyrgyz";
                case 1062: return "Latvian";
                case 1063: return "Lithuanian";
                case 1071: return "Macedonian";
                case 1086: return "Malay (Malaysia)";
                case 2110: return "Malay (Brunei Darussalam)";
                case 1100: return "Malayalam";
                case 1082: return "Maltese";
                case 1153: return "Maori";
                case 1102: return "Marathi";
                case 1104: return "Mongolian";
                case 1044: return "Norwegian (Bokmal)";
                case 2068: return "Norwegian (Nynorsk)";
                case 1045: return "Polish";
                case 1046: return "Portuguese (Brazilian)";
                case 2070: return "Portuguese (Standard)";
                case 1094: return "Punjabi";
                case 1131: return "Quechua (Bolivia)";
                case 2155: return "Quechua (Ecuador)";
                case 3179: return "Quechua (Peru)";
                case 1048: return "Romanian";
                case 1049: return "Russian";
                case 9275: return "Sami (Inari)";
                case 4155: return "Sami (Lule Norway)";
                case 5179: return "Sami (Lule Sweden)";
                case 3131: return "Sami (Northern Finland)";
                case 1083: return "Sami (Northern Norway)";
                case 2107: return "Sami (Northern Sweden)";
                case 8251: return "Sami (Skolt)";
                case 6203: return "Sami (Southern Norway)";
                case 7227: return "Sami (Southern Sweden)";
                case 1103: return "Sanskrit";
                case 2074: return "Serbian (Latin)";
                case 6170: return "Serbian (Latin Bosnia Herzegovina)";
                case 3098: return "Serbian (Cyrillic)";
                case 7194: return "Serbian (Cyrillic Bosnia Herzegovina)";
                case 1051: return "Slovak";
                case 1060: return "Slovenian";
                case 1034: return "Spanish (Traditional Sort)";
                case 2058: return "Spanish (Mexican)";
                case 3082: return "Spanish (Modern Sort)";
                case 4106: return "Spanish (Gautemala)";
                case 5130: return "Spanish (Costa Rica)";
                case 6154: return "Spanish (Panama)";
                case 7178: return "Spanish (Dominican Republic)";
                case 8202: return "Spanish (Venezuela)";
                case 9226: return "Spanish (Colombia)";
                case 10250: return "Spanish (Peru)";
                case 11274: return "Spanish (Argentina)";
                case 12298: return "Spanish (Ecuador)";
                case 13322: return "Spanish (Chile)";
                case 14346: return "Spanish (Uruguay)";
                case 15370: return "Spanish (Paraguay)";
                case 16394: return "Spanish (Bolivia)";
                case 17418: return "Spanish (El Salvador)";
                case 18442: return "Spanish (Honduras)";
                case 19466: return "Spanish (Nicaragua)";
                case 20490: return "Spanish (Puerto Rico)";
                case 1089: return "Swahili";
                case 1053: return "Swedish";
                case 2077: return "Swedish (Finland)";
                case 1114: return "Syriac";
                case 1097: return "Tamil";
                case 1092: return "Tatar";
                case 1098: return "Telugu";
                case 1054: return "Thai";
                case 1074: return "Tswana";
                case 1058: return "Ukrainian";
                case 1055: return "Turkish";
                case 1056: return "Urdu";
                case 1091: return "Uzbek (Latin)";
                case 2115: return "Uzbek (Cyrillic)";
                case 1066: return "Vietnamese";
                case 1106: return "Welsh";
                case 1076: return "Xhosa";
                case 1077: return "Zulu";
                default: return "Unknown";
            }
        }

        private static string GetOperatingSystemSKUName(int sku)
        {
            switch (sku)
            {
                case 0: return "Undefined";
                case 1: return "Ultimate Edition";
                case 2: return "Home Basic Edition";
                case 3: return "Home Premium Edition";
                case 4: return "Enterprise Edition";
                case 5: return "Home Basic N Edition";
                case 6: return "Business Edition";
                case 7: return "Standard Server Edition";
                case 8: return "Datacenter Server Edition";
                case 9: return "Small Business Server Edition";
                case 10: return "Enterprise Server Edition";
                case 11: return "Starter Edition";
                case 12: return "Datacenter Server Core Edition";
                case 13: return "Standard Server Core Edition";
                case 14: return "Enterprise Server Core Edition";
                case 15: return "Enterprise Server Edition for Itanium-Based Systems";
                case 16: return "Business N Edition";
                case 17: return "Web Server Edition";
                case 18: return "Cluster Server Edition";
                case 19: return "Home Server Edition";
                case 20: return "Storage Express Server Edition";
                case 21: return "Storage Standard Server Edition";
                case 22: return "Storage Workgroup Server Edition";
                case 23: return "Storage Enterprise Server Edition";
                case 24: return "Server For Small Business Edition";
                case 25: return "Small Business Server Premium Edition";
                default: return "Unknown";
            }
        }

        private static string GetOSTypeName(int osType)
        {
            switch (osType)
            {
                case 0: return "Unknown";
                case 1: return "Other";
                case 2: return "MACROS";
                case 3: return "ATTUNIX";
                case 4: return "DGUX";
                case 5: return "DECNT";
                case 6: return "Digital UNIX";
                case 7: return "OpenVMS";
                case 8: return "HPUX";
                case 9: return "AIX";
                case 10: return "MVS";
                case 11: return "OS400";
                case 12: return "OS/2";
                case 13: return "JavaVM";
                case 14: return "MSDOS";
                case 15: return "WIN3x";
                case 16: return "WIN95";
                case 17: return "WIN98";
                case 18: return "WINNT";
                case 19: return "WINCE";
                case 20: return "NCR3000";
                case 21: return "NetWare";
                case 22: return "OSF";
                case 23: return "DC/OS";
                case 24: return "Reliant UNIX";
                case 25: return "SCO UnixWare";
                case 26: return "SCO OpenServer";
                case 27: return "Sequent";
                case 28: return "IRIX";
                case 29: return "Solaris";
                case 30: return "SunOS";
                case 31: return "U6000";
                case 32: return "ASERIES";
                case 33: return "TandemNSK";
                case 34: return "TandemNT";
                case 35: return "BS2000";
                case 36: return "LINUX";
                case 37: return "Lynx";
                case 38: return "XENIX";
                case 39: return "VM/ESA";
                case 40: return "Interactive UNIX";
                case 41: return "BSDUNIX";
                case 42: return "FreeBSD";
                case 43: return "NetBSD";
                case 44: return "GNU Hurd";
                case 45: return "OS9";
                case 46: return "MACH Kernel";
                case 47: return "Inferno";
                case 48: return "QNX";
                case 49: return "EPOC";
                case 50: return "IxWorks";
                case 51: return "VxWorks";
                case 52: return "MiNT";
                case 53: return "BeOS";
                case 54: return "HP MPE";
                case 55: return "NextStep";
                case 56: return "PalmPilot";
                case 57: return "Rhapsody";
                default: return "Unknown";
            }
        }

        private static string GetProductTypeName(int productType)
        {
            switch (productType)
            {
                case 1: return "Work Station";
                case 2: return "Domain Controller";
                case 3: return "Server";
                default: return "Unknown";
            }
        }

        private static string ConvertToTimeZone(string unconverted)
        {
            int timeZone = int.Parse(unconverted);
            string strTimeZone="";
            int copy = timeZone;
            int i = 0;
            while (timeZone >= 60)
            {
                i++;
                timeZone -= 60;
            }
            if (copy < 0)
                strTimeZone = "-";
            else
                strTimeZone = "+";
            strTimeZone += i.ToString() + ":" + timeZone.ToString();
            return strTimeZone;
        }

        private static string ConvertToDateTime(string unconvertedTime)
        {
            string convertedTime = "";
            int year = int.Parse(unconvertedTime.Substring(0, 4));
            int month = int.Parse(unconvertedTime.Substring(4, 2));
            int date = int.Parse(unconvertedTime.Substring(6, 2));
            int hours = int.Parse(unconvertedTime.Substring(8, 2));
            int minutes = int.Parse(unconvertedTime.Substring(10, 2));
            int seconds = int.Parse(unconvertedTime.Substring(12, 2));
            string meridian="AM";
            if (hours > 12)
            {
                hours -= 12;
                meridian = "PM";
            }
            convertedTime = date.ToString() + "/" + month.ToString() + "/" + year.ToString() + " " +
                hours.ToString() + ":" + minutes.ToString() + ":" + seconds.ToString() + " " + meridian;
            return convertedTime;
        }
    }
}

Step 5: Write the following code for “Program.cs
using System;
using System.Collections.Generic;
using System.Text;

namespace OS
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Operating System Properties:");
            Console.WriteLine("-----------------------------------------------------------------------------");
            Console.WriteLine("-----------------------------------------------------------------------------");
            Console.WriteLine("BootDevice: " + OSInfo.BootDevice);
            Console.WriteLine("BuildNumber: " + OSInfo.BuildNumber);
            Console.WriteLine("BuildType: " + OSInfo.BuildType);
            Console.WriteLine("Caption: " + OSInfo.Caption);
            Console.WriteLine("CodeSet: " + OSInfo.CodeSet);
            Console.WriteLine("CountryCode: " + OSInfo.CountryCode);
            Console.WriteLine("CSDVersion: " + OSInfo.CSDVersion);
            Console.WriteLine("CSName: " + OSInfo.CSName);
            Console.WriteLine("CurrentTimeZone: " + OSInfo.CurrentTimeZone);
            Console.WriteLine("Description: " + OSInfo.Description);
            Console.WriteLine("Distributed: " + OSInfo.Distributed);
            Console.WriteLine("FreePhysicalMemory: " + OSInfo.FreePhysicalMemory + " kilobytes");
            Console.WriteLine("FreeSpaceInPagingFiles: " + OSInfo.FreeSpaceInPagingFiles + " kilobytes");
            Console.WriteLine("FreeVirtualMemory: " + OSInfo.FreeVirtualMemory + " kilobytes");
            Console.WriteLine("InstallDate: " + OSInfo.InstallDate);
            Console.WriteLine("LastBootUpTime: " + OSInfo.LastBootUpTime);
            Console.WriteLine("LocalDateTime: " + OSInfo.LocalDateTime);
            Console.WriteLine("Locale: " + OSInfo.Locale);
            Console.WriteLine("Manufacturer: " + OSInfo.Manufacturer);
            Console.WriteLine("MaxNumberOfProcesses: " + OSInfo.MaxNumberOfProcesses);
            Console.WriteLine("MaxProcessMemorySize: " + OSInfo.MaxProcessMemorySize + " kilobytes");
            Console.WriteLine("Name: " + OSInfo.Name);
            Console.WriteLine("NumberOfProcesses: " + OSInfo.NumberOfProcesses);
            Console.WriteLine("NumberOfUsers: " + OSInfo.NumberOfUsers);
            Console.WriteLine("OperatingSystemSKU: " + OSInfo.OperatingSystemSKU);
            Console.WriteLine("Organization: " + OSInfo.Organization);
            Console.WriteLine("OSArchitecture: " + OSInfo.OSArchitecture);
            Console.WriteLine("OSLanguage: " + OSInfo.OSLanguage);
            Console.WriteLine("OSType: " + OSInfo.OSType);
            Console.WriteLine("Primary: " + OSInfo.Primary);
            Console.WriteLine("ProductType: " + OSInfo.ProductType);
            Console.WriteLine("RegisteredUser: " + OSInfo.RegisteredUser);
            Console.WriteLine("SerialNumber: " + OSInfo.SerialNumber);
            Console.WriteLine("ServicePackMajorVersion: " + OSInfo.ServicePackMajorVersion);
            Console.WriteLine("ServicePackMinorVersion: " + OSInfo.ServicePackMinorVersion);
            Console.WriteLine("SizeStoredInPagingFiles: " + OSInfo.SizeStoredInPagingFiles + " kilobytes");
            Console.WriteLine("Size: " + OSInfo.Status);
            Console.WriteLine("SystemDevice: " + OSInfo.SystemDevice);
            Console.WriteLine("SystemDirectory: " + OSInfo.SystemDirectory);
            Console.WriteLine("SystemDrive: " + OSInfo.SystemDrive);
            Console.WriteLine("TotalVirtualMemorySize: " + OSInfo.TotalVirtualMemorySize + " kilobytes");
            Console.WriteLine("TotalVisibleMemorySize: " + OSInfo.TotalVisibleMemorySize + " kilobytes");
            Console.WriteLine("Version: " + OSInfo.Version);
            Console.WriteLine("WindowsDirectory: " + OSInfo.WindowsDirectory);
            Console.ReadLine();
        }
    }
}


No comments:

Post a Comment