The essential guide to PowerShell in Exchange
A comprehensive collection of articles, videos and more, hand-picked by our editors
Microsoft has placed an increased emphasis on PowerShell management throughout its 2012-2013 product release cycle....
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
In Exchange 2013 alone, there are 187 new PowerShell cmdlets. If you plan on deploying Exchange 2013 in the near future, there are 10 you should pay attention to.
The Get-ExchangeServerAccessLicense cmdlet reports Exchange licensing information. After entering the cmdlet, you'll receive a report of Standard and Enterprise edition server and CAL licenses for Exchange 2013.
Note: Licensing info for earlier versions of Exchange Server is not provided.
The Get-HealthReport cmdlet reports the health of various Exchange Server 2013 components. For example, you can use the Get-HealthReport to determine Outlook Web App's health by entering the following command:
Get-HealthReport –InputEntries OWA –InputObject Maintenance
The cmdlet returns health information by reporting the object's state, whether online, partially online, functional, unavailable or otherwise.
Message queues reside on mailbox servers in Exchange Server 2013. If a problem occurs with a mailbox server, the Redirect-Message cmdlet can remove the messages from the mailbox server's queue and add them to a queue on a healthy mailbox server.
All you have to do is specify the source and destination server names with the following syntax:
Redirect-Message –Server -Target
Exchange Server is designed to work as a distributed application. An organization might have on-premises mailboxes, cloud mailboxes and mailboxes that exist in external Active Directory forests. In the past, migrating messaging data across these types of boundaries was challenging.
The Test-MigrationServerAvailability cmdlet facilitates this process by verifying that Exchange can communicate with external mail servers prior to attempting a migration.
Users have become increasingly mobile. Admins can use the Get-MobileDevice cmdlet to view a list of all of the mobile devices that have been associated with a given mailbox. For example, to see a list of the mobile devices that are linked to a mailbox named Brien, use the following command:
Get-MobileDevice –Mailbox "Brien"
The Get-MobileDeviceStatistics cmdlet is used to diagnose problems with Exchange ActiveSync. You can use the cmdlet to retrieve a list of ActiveSync-related statistics on a per-mailbox basis. You can also use the cmdlet to retrieve log files related to a mobile device and send those log files to someone for analysis.
At its simplest, the cmdlet requires you to provide the identity of the mailbox that you want to analyze. For example, if you wanted to see mobile device statistics for a mailbox named Brien, you would use the following command:
Get-MobileDeviceStatistics –Identity Brien
Exchange Server 2013 introduces the concept of partner applications. A partner application is designed to work with Exchange to augment the overall end-user experience. SharePoint 2013 is probably the best example of a partner application.
Exchange requires administrators to designate an application as a partner application before it is treated as such. Get-PartnerApplication returns a list of registered partner applications.
The Get-ServerHealth cmdlet is similar to Get-HealthReport, except that it helps you determine the overall health of an Exchange 2013 server, rather than that of an individual component. This PowerShell cmdlet requires you to provide the identity of the Exchange server you want to diagnose, as well as the name of a domain controller. The command syntax is as follows:
Exchange 2013 offers various components that may be used to monitor Exchange. The Set-ServerMonitor cmdlet lets you enable individual server monitors by specifying the name of the monitor and the name of the server.
For example, if you wanted to enable the Maintenance monitor for a server named EX1, you'd use the following command:
Set-ServerMonitor –Name Maintenance –Server EX1
Microsoft has once again embraced public folders in Exchange 2013. In fact, public folders can now be protected by a database availability group (DAG), in much the same way that mailboxes are. Because of this and other new public folder-related features, Microsoft recommends that public folders be migrated to Exchange 2013 mailbox servers.
A public-folder migration is a multistep process, but the primary cmdlet you should familiarize yourself with is the New-PublicFolderMigrationRequest cmdlet. This cmdlet requires you to specify the source database and a .csv file containing exported public folder statistics (the .csv file is created by running the Export-PublicFolderStatistics.ps1 script). Here's an example of how the command might be used:
New-PublicFolderMigrationRequest –SourceDatabase PF1 –CSVData (Get-Content C:\Data\CSVData.csv –Encoding Byte)
As you continue to familiarize yourself with all the new PowerShell cmdlets for Exchange 2013, it's important to understand that Microsoft has retired numerous legacy cmdlets. The retired cmdlets are primarily related to public folder databases and will be covered in a future tip.
About the author
Brien Posey is an eight-time Microsoft MVP with two decades of IT experience. Before becoming a freelance technical writer, Brien worked as a chief information officer at a national chain of hospitals and health care facilities. He has also served as a network administrator for some of the nation's largest insurance companies and for the Department of Defense at Fort Knox.