Stop all Exchange Services

When migrating from Exchange 2007/2010 to Exchange 2013, one of the steps is to test the environment with the old server out of the mix. To do this, you can simply unplug the server (virtual or physical) from the network and see what happens. However, there are times when the server is not physically accessible to you and you need to perform this test anyway. With this script, you can stop all Exchange services and test your environment (mail flow, client connectivity, etc).

<#
Purpose:	Script to stop all exchange services
Author:		Michael Kenning (mjkenning@gmail.com)
Version:	0.2 (beta) (9 JUN 2015)
Usage: 		./stopservice.ps1
#>

$Services = Get-Service | where {$_.Name -like "MSExchange*"}

foreach ($service in $services) {
	if ($service.Status -eq "Running") {
		Stop-Service -InputObj $service
	}
}
Advertisements
Tagged with: , ,
Posted in Powershell

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: