09.02.2014 Views

Windows sysinternals

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

204 Part II Usage Guide<br />

Option<br />

Display options<br />

Description<br />

–m “message” For shutdown operations, displays a dialog box with the specified message to<br />

an interactive user. If this option is not specified, a default notification message<br />

will be displayed.<br />

–c For shutdown operations, adds a Cancel button to the notification dialog box,<br />

allowing an interactive user to cancel the operation.<br />

–v seconds Displays the notification dialog box only for the specified number of seconds<br />

before the shutdown. If this option is not set, the dialog box appears right<br />

away when the shutdown is scheduled. If this option is set to 0, no dialog box<br />

is displayed.<br />

Other options<br />

–t [seconds|hh:mm] Specifies when the shutdown operation should be performed, either in<br />

seconds or as time-of-day in 24-hour format. The default is 20 seconds. (It<br />

cannot be used with –l, –o, or –a.)<br />

–f Forces running applications to terminate. (Note that Shutdown.exe on<br />

<strong>Windows</strong> XP/<strong>Windows</strong> 2003 has a bug in which the logic for its –f option is<br />

unintentionally reversed.)<br />

–e [u|p]:xx:yy Specifies the shutdown reason code, with u for “unplanned” and p for<br />

“planned.”<br />

–n seconds Specifies the timeout in seconds to connect to remote computers.<br />

PsShutdown does not use the InitiateSystemShutdown[Ex] and AbortSystemShutdown APIs<br />

for remote shutdown or for cancellation by the interactive user. Instead, its service displays<br />

a custom interactive dialog box. Therefore, PsShutdown and other utilities cannot be<br />

intermixed to abort each other’s shutdown operations.<br />

The notification and cancellation dialog box is displayed by the PsShutdown service, which<br />

is remotely created and configured as an interactive service. Interactive services are a<br />

deprecated feature of <strong>Windows</strong>, so this feature works as intended only in certain scenarios:<br />

■ On <strong>Windows</strong> XP and Server 2003, the dialog box is displayed only to an interactive user<br />

that is logged on to terminal services session 0, and only if NoInteractiveServices has<br />

not been enabled. With Fast User Switching or Remote Desktop, users can be logged in<br />

to other sessions. The session 0 user can be disconnected or even logged out.<br />

■ On <strong>Windows</strong> Vista and newer, when the PsShutdown service displays the notification,<br />

an interactively logged-on user is notified by the Interactive Services Detection<br />

(UI0Detect) service. This service, if not disabled, allows the user to switch temporarily<br />

to session 0 to interact with the dialog box. If the service has been disabled, interactive<br />

users receive no notifications.<br />

The reason you might want to use the –n option to control the remote connection timeout<br />

is that if you try to use PsShutdown to control a computer that is already off, the command<br />

might appear to hang for a minute before timing out. This delay, which is the standard<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!