The
Win32Shutdown WMI class method provides the full set of shutdown options supported by Win32 operating systems. These include logoff, shutdown, reboot, and forcing a logoff, shutdown, or reboot. The calling process must have the SE_SHUTDOWN_NAME privilege.
Windows NT 4.0 and Windows Me/98/95: SE_SHUTDOWN_NAME privilege is not required.
This topic uses Managed Object Format (MOF) syntax. For more information about using this method, see
Calling a Method.
Syntax
uint32 Win32Shutdown(
sint32 Flags,
sint32 Reserved
);
Parameters
- Flags
-
Bitmapped set of flags to shut the computer down. To force a command, add the Force flag (4) to the command value. Using Force in conjunction with Shutdown or Reboot on a remote computer immediately shuts down everything (including WMI, COM, and so on), or reboots the remote computer. This results in an indeterminate return value.
| Value | Meaning |
- 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)
|
- Reserved
-
A means to extend
Win32Shutdown. Currently, the Reserved parameter is ignored.
Return Value
Returns zero (0) to indicate success. Any other number indicates an error. For error codes, see WMI Error Constants or WbemErrorEnum.
Remarks
The Win32ShutdownTracker method provides the same set of shutdown options supported by the Win32Shutdown method in Win32_OperatingSystem but it also allows you to specify comments, a reason for shutdown, or a timeout.
Windows Server 2003, Windows XP, Windows 2000, Windows NT 4.0, and Windows Me/98/95: The Win32ShutdownTracker method is not available.
Examples
For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.
For C++ code examples, see WMI C++ Application Examples.
Requirements
| Minimum supported client | Windows 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| MOF | Cimwin32.mof |
| DLL | Cimwin32.dll |
| Namespace | \root\cimv2 |
See Also
- Operating System Classes
- Win32_OperatingSystem
- Win32ShutdownTracker
Send comments about this topic to Microsoft
Build date: 11/3/2009