Shutdown Script via PowerShell

We got requested recently to create a shutdown script for a specific number of servers. In PowerShell 2.0 there is a pretty easy way to go about this.

First of all what you need to do is create a TXT file with a list of the servers you want to shut down like so and name it servers.txt

image

Now to go about shutting down the server simply run the following command in PowerShell (Edit the below in bold to point to you TXT File)

Stop-Computer -cn (Get-Content C:ShutdownServer.txt) –force

Once you’ve ran this command the servers will all be shutdown Smile

About the author