Run Microsoft Exchange cmdlets offline

Couple of months ago I wrote about running Lync cmdlets offline. Being a Consultant this helps a lot as I can document and find about the customers environment without connecting to the live Lync environment. Extending the same concept to other Microsoft products which use Power shell (which means pretty much every Microsoft product esp. when PowerShell is part of Microsoft Common Engineering Criteria) is fairly straightforward.

In this post I demonstrate how you can access Exchange cmdlets offline.

The script allows you to execute Exchange cmdlets on your local machine (which may or may not have Exchange Management Shell). This is achieved by using XML files which are exported using export-clixml from Live Lync environment.

Script Pre-requisites
The script requires access to Exchange XML files generated using Exchange Management Shell. The files can be generated in couple of different ways. The generated filename should have the cmdlets name prefixed to it (eg: get-mailbox cmdlets filename should be get-mailbox.xml).

Below is a sample snippet you can use to export most of the Exchange configuration into XML files.

foreach ($a in get-command get-* | ? {$_.commandtype -eq "Function"})
{ If (($ -match "Get-ActiveSyncDeviceStatistics") -or ($ -match "Get-ADPermission") -or
     ($ -match "Get-CalendarDiagnosticLog") -or ($ -match "Get-CalendarNotification") -or ($ -match "Get-CalendarProcessing") -or
     ($ -match "Get-DistributionGroupMember") -or ($ -match "Get-FailedContentIndexDocuments") -or ($ -match "Get-FederatedDomainProof") -or
     ($ -match "Get-FederationInformation") -or ($ -match "Get-LogonStatistics") -or ($ -match "Get-MailboxAutoReplyConfiguration") -or
     ($ -match "Get-MailboxCalendarConfiguration") -or ($ -match "Get-MailboxCalendarFolder") -or ($ -match "Get-MailboxFolderPermission") -or
     ($ -match "Get-MailboxFolderStatistics") -or ($ -match "Get-MailboxJunkEmailConfiguration") -or ($ -match "Get-MailboxMessageConfiguration") -or
     ($ -match "Get-MailboxPermission") -or ($ -match "Get-MailboxRegionalConfiguration") -or ($ -match "Get-MailboxRestoreRequestStatistics") -or
     ($ -match "Get-MailboxSentItemsConfiguration") -or ($ -match "Get-MailboxSpellingConfiguration") -or ($ -match "Get-MailboxStatistics") -or
     ($ -match "Get-ManagementRoleEntry") -or ($ -match "Get-MessageTrackingReport") -or ($ -match "Get-MoveRequestStatistics") -or
     ($ -match "Get-PhysicalAvailabilityReport") -or ($ -match "Get-PublicFolderAdministrativePermission") -or ($ -match "Get-PublicFolderClientPermission") -or
     ($ -match "Get-PublicFolderItemStatistics") -or ($ -match "Get-RoleGroupMember") -or ($ -match "Get-ServiceAvailabilityReport") -or
     ($ -match "Get-StoreUsageStatistics") -or ($ -match "Get-UMCallSummaryReport") -or ($ -match "Get-UMMailboxConfiguration") -or
     ($ -match "Get-ADPermission1") -or ($ -match "Get-TextMessagingAccount") -or ($ -match "Get-UMCallDataRecord")
  Else {&$a -erroraction silentlycontinue | Export-Clixml -path $a".xml"}

The screenshot below shows the above snippet being run and the resulting XML files.


Once you have exported the XML files, copy the files over to your local machine. The exported XML files can be extremely large but if you zip them up and reduce the size by almost 5-10 times!. You do not have to copy all the XML files if you don’t want the output of all the cmdlets.

Script Execution

Download the script from here. On your local machine open PowerShell and launch the script. The script accepts only one parameter folderpath.This is the location where XML files are located you exported previously. This will typically be your local machine (NOT Exchange Server)

Browse to the script and enter the folder path where XML files are located


To view which cmdlets are available enter:

Get-Command get-* -CommandType Function | ? {$_.module -eq $null}image
Execute any Exchange cmdlet



  1. As all the data is generated using XML files no inbuilt Exchange Management Shell filtering is available, e.g: you cannot use –filter parameter but all native PowerShell filtering can be used.
  2. Any cmdlets which require user input during the export should be excluded until you want to provide an argument.
  3. Similar to Lync (get-cs*) Exchange does not provide a quick way to discover/display Exchange specific cmdlets , so some of the exported XML files and resulting output may contain non-Exchange cmdlets but this should not cause any issues.

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve this to prove you are not a bot * Time limit is exhausted. Please reload the CAPTCHA.

Post Navigation