Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Код вывода большого количества разной информации о операционной системе, в том числе ее версию, номер сервиспака, количества свободной памяти и многое другое:
- using System;
- using System.Management;
- namespace test
- {
- class Program
- {
- public static void Main(string[] args)
- {
- ManagementObjectSearcher searcher5 =
- new ManagementObjectSearcher("root\\CIMV2",
- "SELECT * FROM Win32_OperatingSystem");
- foreach (ManagementObject queryObj in searcher5.Get())
- {
- Console.WriteLine("-----------------------------------");
- Console.WriteLine("Win32_OperatingSystem instance");
- Console.WriteLine("-----------------------------------");
- Console.WriteLine("BuildNumber: {0}", queryObj["BuildNumber"]);
- Console.WriteLine("Caption: {0}", queryObj["Caption"]);
- Console.WriteLine("FreePhysicalMemory: {0}", queryObj["FreePhysicalMemory"]);
- Console.WriteLine("FreeVirtualMemory: {0}", queryObj["FreeVirtualMemory"]);
- Console.WriteLine("Name: {0}", queryObj["Name"]);
- Console.WriteLine("OSType: {0}", queryObj["OSType"]);
- Console.WriteLine("RegisteredUser: {0}", queryObj["RegisteredUser"]);
- Console.WriteLine("SerialNumber: {0}", queryObj["SerialNumber"]);
- Console.WriteLine("ServicePackMajorVersion: {0}", queryObj["ServicePackMajorVersion"]);
- Console.WriteLine("ServicePackMinorVersion: {0}", queryObj["ServicePackMinorVersion"]);
- Console.WriteLine("Status: {0}", queryObj["Status"]);
- Console.WriteLine("SystemDevice: {0}", queryObj["SystemDevice"]);
- Console.WriteLine("SystemDirectory: {0}", queryObj["SystemDirectory"]);
- Console.WriteLine("SystemDrive: {0}", queryObj["SystemDrive"]);
- Console.WriteLine("Version: {0}", queryObj["Version"]);
- Console.WriteLine("WindowsDirectory: {0}", queryObj["WindowsDirectory"]);
- }
- Console.Write("Press any key to continue . . . ");
- Console.ReadKey(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement