2 out of 2 rated this helpful - Rate this topic

Win32ShutdownTracker method of the Win32_OperatingSystem class

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. The calling process must have the SE_SHUTDOWN_NAME privilege.

Syntax


uint32 Win32ShutdownTracker(
  [in, optional]  uint32 Timeout,
  [in]            string Comment,
  [in]            uint32 ReasonCode,
  [in]            sint32 Flags
);

Parameters

Timeout [in, optional]

Time, in seconds, before shutdown takes place. The default value is 0 (zero).

Comment [in]

Message to display in the shutdown dialog box that is also stored as a comment in the event log entry.

ReasonCode [in]

Reason for initiating the shutdown.

Flags [in]

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.

ValueMeaning
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)

 

Return value

Returns zero (0) to indicate success. Any other number indicates an error. For error codes, see WMI Error Constants or WbemErrorEnum.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Namespace

\root\CIMV2

MOF

Cimwin32.mof

DLL

Cimwin32.dll

See also

Operating System Classes
Win32_OperatingSystem
Win32Shutdown

 

 

Send comments about this topic to Microsoft

Build date: 11/19/2012

Community Additions

ADD
© 2013 Microsoft. All rights reserved.