Home > PowerShell > One Liner: Configuring Shutdown Tracker in Windows Server

One Liner: Configuring Shutdown Tracker in Windows Server

When you spend time building servers, there are often some minor tweaks that you use to make life easier. In many environments, Group Policy Objects (GPOs) are used to configure these settings. But in a lot of environments, that’s not the case. If you build a lot of servers, you may have some scripts to help streamline the process. I often see this being the case among consultants who are engaged to deploy a solution. If you’ve followed my blog for a while, you know that’s what I do. And I look for many ways to streamline the deployment. Many solutions I write are all about the actual deployment, whereas this particular post is about the working environment I’ll be spending time in.

One thing that always drives me nuts is the Shutdown Tracker. That’s the little dialog box that pops up when you want to restart or shutdown a server. You’re presented with a prompt to pick the reason why you’re restarting or shutting down. While this can certainly have its place in an enterprise environment, it’s not generally needed during a deployment. And it’s not likely needed in a lab environment where you might be testing various configurations and restarting often. So let’s gag that annoying prompt.

To disable Shutdown Tracker, open an elevated PowerShell prompt and enter the following one line:

Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Reliability" -Name ShutdownReasonOn -Value 0

This will take care of the problem. If you later want to enable the Shutdown Tracker, you can simply run it again, specifying a 1 for the value.

We can make this a little more flexible by creating a function to let us enable or disable as needed.

function Set-ShutdownTracker {
	[CmdletBinding(SupportsShouldProcess = $True, SupportsPaging = $True, DefaultParameterSetName = "disabled")]
	param(
		# Disable the shutdown tracker
		[Parameter(ValueFromPipeline = $False, ValueFromPipelineByPropertyName = $True, ParameterSetName = "disabled")]
		[switch] $Disabled,
		
		# Enable the shutdown tracker
		[Parameter(ValueFromPipeline = $False, ValueFromPipelineByPropertyName = $True, ParameterSetName = "enabled")]
		[switch] $Enabled
	)
	switch ($PsCmdlet.ParameterSetName) {
		"enabled" {
			Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Reliability" -Name ShutdownReasonOn -Value 1
		}
		"disabled" {
			Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Reliability" -Name ShutdownReasonOn -Value 0
		}
	}
} # end function Set-ShutdownTracker

And the script can be called with either the -Enabled or -Disabled parameters.

Adding the one liners or the function to your deployment scripts might make life a little easier.

  1. February 27th, 2015 at 13:10 | #1

    Thanks for this , Pat – “gag that annoying prompt” is a worthwhile goal

  2. Todd
    October 18th, 2017 at 11:57 | #2

    Apparently, for Server 2016, an additional registry key must be configured:

    Set-ItemProperty -Path “HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Reliability” -Name ShutdownReasonUI -Value 0

    If this isn’t included, you may get a list of reasons with no choices to select!

    Thanks for posting this info!

  3. Todd
    October 18th, 2017 at 12:07 | #3

    Additionally, these two registry changes aren’t reflected in the “Display Shutdown Event Tracker” setting in gpedit.msc. I configured both “ShutdownReasonOn” and “ShutdownReasonUI” to 0, which caused the prompt to stop, but gpedit continues to show the tracker as enabled. I even deleted both keys with no effect.

  1. February 26th, 2015 at 02:22 | #1
  2. February 26th, 2015 at 02:31 | #2