Exchange 2013 PowerShell Scripts – A Practical Guide – Part 2

For part two (2) of my series on Practical Exchange scripts I will cover prewritten scripts that come from MVPs and other Exchange engineers as well as some of my scripts that I have created over the years. The purpose is to provide a sampling of what can be done with Exchange Powershell to help support, manage and maintain your Exchange organization.

PreWritten Scripts
On TechNet Gallery as well as various MVP blogs on Exchange Server, there are plenty of prewritten scripts to help manage your environment. These scripts provide things like installing prerequisites for Exchange, to creating health reports, to managing group memberships. Let’s explore some sample prewritten scripts and see what can be done with them.

First example is one of many health scripts that are out there this script is a good example of what the MVP community provides for support engineers.
Good examples that I have used in the past are listed here:

That is just a small sampling of the scripts that are out there. When it comes to the health reports, these reports can make your life easier either for day-to-day operations, pre migration work or just a quarterly/yearly check-up.

Your own scripts
Now that you’ve seen what is possible with PowerShell Scripts and Exchange, it’s time to explore writing your own scripts. Depending on your environment, you can create scripts to help with user creation or product custom reports that only make sense for your environment. Personally I’ve created scripts that install Exchange 2013 prerequisites, to cleaning up old DLs, to customer space reports for my Exchange servers that were emailed daily to

Simpler scripts can be created.

Services – Starting and Stopping via Script
For example, I have a script that I use to stop and start Exchange Services. Works great for either troubleshooting, quicker reboots, or other maintenance work.

This is what it looks when you stop or start the services:

Start Services
Stop Services

Another script I have written is for installing the Prerequisites that are needed for Exchange Server 2013. This script will work on Windows 2008 R2, Windows 2012 and Windows 2012 R2. The current version can be downloaded from Technet here.

First, make sure that your execution policy is set right. As most self-written scripts are not going to have a digital signature, setting the policy to unrestricted allows the script to be run:

The once the script is kicked off, you get a menu with quite a few options. For most Exchange installations 3 and 4 will allow a combined role (CAS and Mailbox) server to be installed. There are also options for verifying the prereqs are installed:

Once an option is selected, the script will go ahead and install the valid components.

After Step 3 is completed type in 98 to reboot the server.

After the reboot, run step 4 and reboot once more to make sure all changes are set correctly.


Quick verification of requirements:

Windows 2008 R2
Windows 2012/R2

The best scripts in this category are the ones that satisfy the needs of the organization. I’ve helped write scripts to examine the Administrator Audit Log for the security team to scripts that produce small daily emails on the status of services, database size and free disk space. Writing your own script will allow control over your Exchange organization.


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s