- Show operating system windows
- WSH + WMI. Примеры. Класс Win32_OperatingSystem
- Методы
- Пример получения сведений об операционной системе. WSH + WMI.
- How Operating Systems Work
- How to Determine Your Operating System
- Which version of Windows operating system am I running?
- Find operating system info in Windows 10
- Related links
- Find operating system info in Windows 8.1 or Windows RT 8.1
- Related links
- Find operating system info in Windows 7
- Related links
- Operating System Version
Show operating system windows
WSH + WMI. Примеры. Класс Win32_OperatingSystem
Класс возвращают экземпляр активной в настоящее время операционной системы и содержит сведения о этой системе, ее состоянии и настройках.
Методы
Класс Win32_OperatingSystem имеет следующие методы:
Метод | Описание |
Reboot | Завершает работу, а затем перезапускает компьютерную систему. |
SetDateTime | Позволяет устанавливать дату и время на компьютере. |
Shutdown | Выгружает программы и DLL-библиотеки в месте, где это безопасно для выключения компьютера. |
Win32Shutdown | Предоставляет полный набор опций отключения операционных систем Windows. |
Win32ShutdownTracker | Обеспечивает тот же набор опций отключения, поддерживаемых Win32Shutdown, и дополнительно позволяет указать причину остановки, или тайм-аут. |
Метод Reboot класса Win32_OperatingSystem
Метод Reboot выключает компьютерную систему, затем перезапускает ее.
Не имеет параметров.
Метод SetDateTime класса Win32_OperatingSystem
Метод устанавливает текущее системное время на компьютере.
Параметры — значение текущего времени
У пользователя, от имени которого выполняется SetDateTime должны быть соответствующие права.
Минимальная клиентская ОС — Windows Vista
Минимальная серверная ОС — Windows Server 2003
Метод Shutdown класса Win32_OperatingSystem
Этот метод немедленно отключает компьютер, если это возможно. Система останавливает все запущенные процессы, очищает все файловые буферы, а затем выключает систему
Не имеет параметров.
Метод Win32Shutdown класса Win32_OperatingSystem
Метод Win32Shutdown обеспечивает полный набор опций отключения поддерживаемых операционных систем Win32. Он включает logoff, shutdown, reboot.
Параметры: Flags, Reserved
Значения параметра Flags
Значение | Описание |
0 (0x0) | Log Off. останавливает все процессы, связанные с контексте безопасности процесса и отображает диалоговое окно входа в систему. |
4 (0x4) | Принудительный Log Off. Немедленный выход. Не уведомляет приложения, сессия входа в систему заканчивающиеся. Это может привести к потере данных. |
1 (0x1) | Shutdown. Выключить компьютер к точке, где это безопасно выключить питание. Процессы и пользователь уведомляются. |
5 (0x5) | Forced Shutdown (1 + 4). Принудительное выключение. Выключить компьютер к точке, где это безопасно выключить питание. Пользователи уведомляются. Все файловые буферы сбрасываются на диск, и все запущенные процессы останавливаются. Из-за этого, вы не сможете получить возвращаемого значения, если вы работаете на удаленном компьютере. |
2 (0x2) | Reboot (2 + 4). Завершает работу, а затем перезагружает компьютер. |
6 (0x6) | Forced Reboot (2 + 4) . Принудительная перезагрузка. Завершает работу, а затем перезагружает компьютер. Все запущенные процессы останавливаются. Из-за этого, вы не сможете получить возвращаемого значения, если вы работаете на удаленном компьютере. |
8 (0x8) | Power Off. Выключить компьютер и выключить питание (если поддерживается компьютером). |
12 (0xC) | Forced Power Off (8 + 4). Принудительное отключение питания. Выключить компьютер и выключить питание (если поддерживается компьютером). Все запущенные процессы останавливаются. Из-за этого, вы не сможете получить возвращаемого значения, если вы работаете на удаленном компьютере. |
Значения параметра Reserved.
Средства для расширения Win32Shutdown. В настоящее время параметр игнорируется.
Минимальная клиентская ОС — Windows Vista
Минимальная серверная ОС — Windows Server 2003
Метод Win32ShutdownTracker класса Win32_OperatingSystem.
Предоставляет тот же набор опций отключения поддерживаемых Win32Shutdown метода в Win32_OperatingSystem, но это также позволяет указать комментарии, причину остановки, или тайм-аут.
Параметры: Timeout, Comment, ReasonCode, Flags
Timeout — опционально — время, в секундах, перед выключением. Значение по умолчанию равно 0 (нулю).
Comment — сообщение для отображения в диалоговом окне завершения работы, также оно хранится в виде комментария в журнале событий ( event log ).
ReasonCode — код причины отключения.
Flags
Значение | Описание |
0 (0x0) | Log Off. |
4 (0x4) | Forced Log Off (0 + 4). |
1 (0x1) | Shutdown. |
5 (0x5) | Forced Shutdown (1 + 4). |
2 (0x2) | Reboot. |
6 (0x6) | Forced Reboot (2 + 4). |
8 (0x8) | Power Off. |
12 (0xC) | Forced Power Off (8 + 4). |
Наличие кода 4 в этом параметре при работе на удаленном компьютере приведет к тому, что код возврата будет неопределен.
Пример получения сведений об операционной системе. WSH + WMI.
В документации приведен следующий пример:
Более подробно о классе Win32_OperatingSystem смотрите на MSDN.
Для вопросов, обсуждений, замечаний, предложений и т. п. можете использовать раздел форума этого сайта (требуетс¤ регистраци¤).
How Operating Systems Work
When you turn on your computer, it’s nice to think that you’re in control. There’s the trusty computer mouse, which you can move anywhere on the screen, summoning up your music library or Internet browser at the slightest whim. Although it’s easy to feel like a director in front of your desktop or laptop, there’s a lot going on inside, and the real man behind the curtain handling the necessary tasks is the operating system.
Most desktop or laptop PCs come pre-loaded with Microsoft Windows. Macintosh computers come pre-loaded with Mac OS X. Many corporate servers use the Linux or UNIX operating systems. The operating system (OS) is the first thing loaded onto the computer — without the operating system, a computer is useless.
More recently, operating systems have started to pop up in smaller computers as well. If you like to tinker with electronic devices, you’re probably pleased that operating systems can now be found on many of the devices we use every day, from cell phones to wireless access points. The computers used in these little devices have gotten so powerful that they can now actually run an operating system and applications. The computer in a typical modern cell phone is now more powerful than a desktop computer from 20 years ago, so this progression makes sense and is a natural development.
The purpose of an operating system is to organize and control hardware and software so that the device it lives in behaves in a flexible but predictable way. In this article, we’ll tell you what a piece of software must do to be called an operating system, show you how the operating system in your desktop computer works and give you some examples of how to take control of the other operating systems around you.
How to Determine Your Operating System
Content Type Product Information & Documentation
Article ID 000018246
Last Reviewed 02/11/2020
Follow these steps to determine which Windows* operating system is running on your computer.
Windows® 10
- Click the Start or Windows button (usually in the lower-left corner of your computer screen).
- Click Settings.
- Click About (usually in the lower left of the screen). The resulting screen shows the edition of Windows.
Windows 8* or Windows 8.1*
Option 1: From the desktop
- Swipe in from the upper-right corner of the screen while viewing the desktop to open the menu, and then touch Settings.
- Select PC Info. Under Windows edition, the Windows version is shown.
Option 2: From the Start Screen
- While on the Start screen, type computer.
- Right-click the computer icon. If using touch, press and hold on computer icon.
- Click or tap Properties. Under Windows edition, the Windows version is shown.
Windows 7*
- Click the Start or Windows button (usually in the lower-left corner of your computer screen).
- Right-click Computer and choose Properties from the menu. The resulting screen shows the Windows version.
Note | Intel® WiDi isn’t supported on Windows XP* or Windows Vista*. |
See the Microsoft sites below for more details:
Which version of Windows operating system am I running?
Find operating system info in Windows 10
To find out which version of Windows your device is running, press the Windows logo key + R, type winver in the Open box, and then select OK.
Here’s how to learn more:
Select the Start button > Settings > System > About .
Under Device specifications > System type, see if you’re running a 32-bit or 64-bit version of Windows.
Under Windows specifications, check which edition and version of Windows your device is running.
Related links
If you’re having a problem with activation, see Activate in Windows 10.
If you forgot the password you use to sign in to Windows devices or email, see How to reset your Microsoft password.
For info about updating Windows, see Windows Update: FAQ.
Find operating system info in Windows 8.1 or Windows RT 8.1
To find out which version of Windows your device is running, press the Windows logo key + R, type winver in the Open box, and then select OK.
If your device is running Windows 8.1 or Windows RT 8.1, here’s how to learn more:
If you’re using a touch device, swipe in from the right edge of the screen, tap Settings, and then tap Change PC settings. Continue to step 3.
If you’re using a mouse, point to the lower-right corner of the screen, move the mouse pointer up, click Settings, and then click Change PC settings.
Select PC and devices > PC info.
Under Windows you’ll see which edition and version of Windows your device is running.
Under PC > System type you’ll see if you’re running a 32-bit or 64-bit version of Windows.
Related links
If you’re having a problem with activation, see Activate Windows 7 or Windows 8.1
If you forgot the password you use to sign in to Windows devices or email, see How to reset your Microsoft password.
For info about updating Windows, see Windows Update: FAQ.
Find operating system info in Windows 7
Select the Start button, type Computer in the search box, right-click on Computer, and then select Properties.
Under Windows edition, you’ll see the version and edition of Windows that your device is running.
Support for Windows 7 ended on January 14, 2020
We recommend you move to a Windows 10 PC to continue to receive security updates from Microsoft.
Related links
If you’re having a problem with activation, see Activate Windows 7 or Windows 8.1.
If you forgot the password you use to sign in to Windows devices or email, see How to reset your Microsoft password.
For info about updating Windows, see Windows Update: FAQ.
Operating System Version
The Version API Helper functions are used to determine the version of the operating system that is currently running. For more information, see Getting the System Version.
The following table summarizes the most recent operating system version numbers.
Operating system | Version number |
---|---|
Windows 10 | 10.0* |
Windows Server 2019 | 10.0* |
Windows Server 2016 | 10.0* |
Windows 8.1 | 6.3* |
Windows Server 2012 R2 | 6.3* |
Windows 8 | 6.2 |
Windows Server 2012 | 6.2 |
Windows 7 | 6.1 |
Windows Server 2008 R2 | 6.1 |
Windows Server 2008 | 6.0 |
Windows Vista | 6.0 |
Windows Server 2003 R2 | 5.2 |
Windows Server 2003 | 5.2 |
Windows XP 64-Bit Edition | 5.2 |
Windows XP | 5.1 |
Windows 2000 | 5.0 |
* For applications that have been manifested for Windows 8.1 or Windows 10. Applications not manifested for Windows 8.1 or Windows 10 will return the Windows 8 OS version value (6.2). To manifest your applications for Windows 8.1 or Windows 10, refer to Targeting your application for Windows.
Identifying the current operating system is usually not the best way to determine whether a particular operating system feature is present. This is because the operating system may have had new features added in a redistributable DLL. Rather than using the Version API Helper functions to determine the operating system platform or version number, test for the presence of the feature itself.
To determine the best way to test for a feature, refer to the documentation for the feature of interest. The following list discusses some common techniques for feature detection:
- You can test for the presence of the functions associated with a feature. To test for the presence of a function in a system DLL, call the LoadLibrary function to load the DLL. Then call the GetProcAddress function to determine whether the function of interest is present in the DLL. Use the pointer returned by GetProcAddress to call the function. Note that even if the function is present, it may be a stub that just returns an error code such as ERROR_CALL_NOT_IMPLEMENTED.
- You can determine the presence of some features by using the GetSystemMetrics function. For example, you can detect multiple display monitors by calling GetSystemMetrics(SM_CMONITORS).
- There are several versions of the redistributable DLLs that implement shell and common control features. For information about determining which versions are present on the system your application is running on, see the topic Shell and Common Controls Versions.
If you must require a particular operating system, be sure to use it as a minimum supported version, rather than design the test for the one operating system. This way, your detection code will continue to work on future versions of Windows.
Note that a 32-bit application can detect whether it is running under WOW64 by calling the IsWow64Process function. It can obtain additional processor information by calling the GetNativeSystemInfo function.