Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Say I use "shutdown -s -f -t 13600" to initiate a scheduled shutdown.

In Windows XP, I would always see a dialogbox alerting me of the impending shutdown.

In Windows 7 however it shows a popup in the system tray, which disappears after a couple of seconds.

How do I query, or enable a dialog like Windows XP for me to know when the shutdown is going to happen?

share|improve this question

I've found a way.

If instead of using shutdown -s -f -t 13600

you use shutdown -s -f -t 13600 -c "13600"

The -c option adds a comment to the shutdown event logged by Windows Event Viewer

Your comment of "13600" will be visible in the Event Viewer as seen in the red oval: event viewer showing system events

To see this view yourself:type Event Viewer in the start menu and go to Windows Logs -> System and you will see a list of system events.

Any events with an Event ID of 1074 will be a delayed shutdown.

So what we want is some code that gets the last 1074 event, looks up the value in the comment of the event and adds that value (in seconds) to the time the event was created, thus giving the shutdown time.

I made a function for Windows PowerShell (comes with Windows 7) that does that:

function nextShutdownTime
    $events = Get-WinEvent -FilterHashtable @{logname="system"; id=1074}
    $event = $events[0]
    $eventXML = [xml]$event.ToXml()
    return $event.TimeCreated.addSeconds([int]$eventXML.Event.EventData.Data[5])

Just add it to your PowerShell Profile and in PowerShell just run the command nextShutdownTime to see the expected shutdown time.

share|improve this answer

I just spent about an hour trying to make this work exactly as you wanted somehow. I experimented, and searched and searched, but I could not get it perfect, but I was able to come up with something.

I tried every combination of shutdown (-i -c -d options), but nothing.

I also experimented with the GUI interface after the -i option.

I also tried changing the balloon time display so it would stay down in the systray longer, but still, even that disappears.

The closest I go with with this sample command: shutdown -i -r -t 300

I think the fact is that they simply changed the way it works, and I don't think there is any way around it 100%, but the -i now brings up a dialog box, whereas it used to bring up the screen you wanted. When I used the -i in Windows 7, I had to fill out the box, and here was the result:

enter image description here

Then I hit Enter and got this:

enter image description here

I tested, and it seems that the upper value you can put in the "Display warning for X Seconds" is only 600, despite the fact you can enter up to 999 (very strange programming).

share|improve this answer
I just realized that it still does not do the countdown thing either. – KCotreau Jul 30 '11 at 16:13
Yeah, the server 2008 shutdown along with the xp shutdown only allow you up to 600 seconds. The windows 7 and 2008R2 allow something like up to 10 years. – surfasb Jul 31 '11 at 5:16

How do I query, or enable a dialog like Windows XP for me to know when the shutdown is going to happen?

The native shutdown program in Windows 7 does not provide a countdown dialog (or a cancel button) like previous versions of Windows did.

If you need to schedule a shutdown and provide a countdown and cancel button you can use an HTA application, which can have text, images, a countdown and a cancel button.

Here is an example: HTA Script - Shutdown script and warning message

Shutdown dialog

Source is my personal blog.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .