There are many different ways we can shutdown Windows Server 2016, in this quick guide we’ll demonstrate how to perform a power off through the graphical user interface, with command prompt, PowerShell, or even remotely.
The command prompt and PowerShell options are particularly useful if you need to script these tasks.
Shutdown From GUI
If you have the graphical user interface component installed in Windows Server 2016, you can shut down simply by clicking the start button followed by the Power button, and then shut down.
Shutdown From Command Prompt
If you do not have the GUI installed, or you simply prefer the command line, we can also perform a system power off with the ‘shutdown’ command.
C:\> shutdown -s
The -s option is used to specify that we want to stop the computer and power off. By default this will start less than a minute after the command has been run, however with the use of the -t option we can alternatively specify the number of seconds we wish to wait.
Shutdown From PowerShell
Similarly to the above example we can perform a power off with the command line using Microsoft’s newer PowerShell by running the ‘Stop-Computer’ cmdlet.
PS C:\> Stop-Computer
We can also use PowerShell to remotely power off a Windows Server, again this is done with the ‘Stop-Computer’ cmdlet, except we specify the name of the computer that we want to shutdown.
PS C:\> Stop-Computer -ComputerName "web01"
This will initiate a shutdown of the ‘web01’ server, as specified by the -ComputerName option. It will only work if either the credentials on “web01” are the same as the current machine the command is run from, for instance if the remote server is a member of the same domain and your user account has these permissions.
If the remote server requires authentication, we can first use the Get-Credential cmdlet followed by the ‘computername\username’ at which point we will be prompted for the password. In the below example we store this output into the variable ‘$a’. We then perform the shutdown and specify the -Credential option, passing it the contents stored in $a.
We have seen that there are a number of different ways in which we can safely perform a shutdown of Windows Server 2016. You can perform a power off through the GUI, command prompt, PowerShell, or even remotely from another system.