Exchange Management Shell reference
This appendix provides additional information related to the Exchange Management Shell (EMS). You can use this section as a reference for finding commonly-used automatic shell variables and type accelerators, along with a listing of commonly-used EMS scripts that are installed with Exchange 2013. Additionally, common filterable properties supported by EMS cmdlets that include filter parameters are outlined in detail.
Commonly-used shell variables
PowerShell and the Exchange Management Shell provide several automatic variables. The following table provides a list of commonly-used automatic variables with a description for each one:
Variable Name |
Description |
---|---|
|
Contains the last token in the last command received. |
|
Contains the execution status of the last command. |
|
Contains the first token in the last command received. |
|
Contains the current object being processed within a pipeline. |
|
Contains an array of undeclared arguments received by a function, script, or script block. |
|
Contains an array of error objects recorded in the current shell session. The latest error can be accessed using the zero index of the array, that is, |
|
References the full path to the |
|
References the full path to the Exchange scripts directory. This variable is only present when starting the shell using the Exchange Management Shell shortcut on a machine with the Exchange tools installed. |
|
Provides a Boolean false value when used in commands and scripts. |
|
Contains the enumerator inside a |
|
Contains the full path to the user's home directory. |
|
Contains an object that represents the current PowerShell host application. |
|
Contains the enumerator for items passed to a function. The |
|
Specifies the maximum number of entries that can be saved in the command history in the current shell session. |
|
Provides a |
|
Contains the full path to the PowerShell profile for the current user and the current host application. |
|
Contains the full path to the installation directory of Windows PowerShell. |
|
Contains the path to the current location. |
|
Provides a Boolean true value. |
To view the variables currently defined in your shell session, run Get-Variable
. You can also read more about PowerShell variables by running the Get-Help <TopicName>
cmdlet on the following about
topics:
about_Automatic_Variables
about_Environment_Variables
about_Preference_Variables
Note
The preceding topics only reference PowerShell-specific variables, and not the shell variables that are specific to the Exchange Management Shell.
Commonly-used type accelerators
Type accelerators, also referred to as type shortcuts, allow you to create an object of a specific .NET Framework type without having to enter the entire type name. This is a feature that is supported by both PowerShell and the Exchange Management Shell, and allows you to reduce the amount of typing required when creating an object or explicitly typing a variable. The following table lists some of the most commonly-used type shortcuts:
Type shortcut |
.NET framework type |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Scripts available in the $Exscripts directory
The following table lists some of the most commonly-used EMS PowerShell scripts that are installed with Exchange 2013:
Name |
Description |
---|---|
|
Adds a user and their permissions to the client permissions list for a public folder and all the folders beneath it in the hierarchy. |
|
Monitors the redundancy of replicated mailbox databases. |
|
Fixes recipient objects that have multiple primary SMTP addresses defined. |
|
Reports on the database availability group, switchover, and failover metrics. |
|
Reports on the replication status and statistics for databases. |
|
Converts the OAB virtual directory to an IIS web application/application pool. |
|
Provides end-to-end latency information gathered from message tracking logs. |
|
Generates the maintenance and quota notification schedule time based on a set of input values. |
|
Disables Antimalware scanning. |
|
Used to undo the changes made by the |
|
Enables Antimalware scanning. |
|
Configures a send connector for cross-forest trust for anonymous users. |
|
Enables In Memory Tracing. |
|
Configures Exchange Unified Messaging for the use of Office Communications Server. |
|
Exports the properties of all the mail-enabled public folders to a CSV file. |
|
Generates a CSV file with lists of public folders and the individual sizes. |
|
Exports retention tags to an external file. |
|
Generates a report on anti-spam filtering. |
|
Reports on all entries for the Content Filter and groups by SCL values. |
|
Reports on the top 10 (unless specified otherwise) sender domains blocked by anti-spam agents. |
|
Reports on the top 10 (unless specified otherwise) sender IPs blocked by anti-spam agents. |
|
Reports on the top 10 (unless specified otherwise) senders blocked by anti-spam agents. |
|
Reports on the top 10 (unless specified otherwise) reasons for rejection by blocklist providers. |
|
Reports on the top 10 (unless specified otherwise) recipients rejected by anti-spam agents. |
|
Reports on the UC Pools created by OCS/Lync. |
|
Returns a list of engines being used by the forefront filtering agent. |
|
Imports the mail-enabled public folders from a CSV file and calls the cmdlet |
|
Imports retention tags from an external file. |
|
Installs the anti-spam agents on a mailbox server. |
|
Validates the safety of the environment, before swapping failed database copy to a spare disk and reseeding. |
|
Manages scheduled tasks in PowerShell. |
|
Merges the contents of the given public folder mailbox with the target public folder mailbox. |
|
Migrates a copy of all Unified Messaging custom prompts. |
|
Moves the contents of folders that reside along with the given folder to the target public folder mailbox. |
|
Moves the queue database to an alternate disk on a transport server. |
|
Works like the |
|
Creates a test user that can be used when testing connectivity on CAS servers. |
|
Prepares mailboxes for cross-forest mailbox moves. |
|
Generates a CSV mapping file that contains the public folder to the mailbox structure. |
|
Attempts to redistribute active databases evenly across a number of mailbox servers within a DAG. |
|
Reinstalls default transport agents on servers. |
|
Removes a user from the client permissions list for a public folder and all the folders beneath it in the hierarchy. |
|
Replaces the permissions of a user for a public folder with a new set of permissions and applies it to all the folders beneath it in the hierarchy. |
|
Replaces a user for a new user on the client permissions list for a public folder and applies it to all the folders beneath it in the hierarchy. |
|
Removes the anti-spam agents from a transport server. |
|
Resets the list of attachment types for attachment-filtering to factory set defaults. |
|
Resets the virtual directory on CAS. |
|
Resumes activation and logfile replication for specified mailbox databases. |
|
Updates the service account credentials and distributes the update to specified CAS servers. |
|
Prints the result of |
|
Splits the given public folder mailbox based on the size of the folders. |
|
Initiates DAG server maintenance. |
|
Stops DAG server maintenance and resumes mailbox database copies. |
|
This file contains global constants used by the Store Database Troubleshooters. |
|
A collection of Store Troubleshooting on Content Index (CI) catalogs. |
|
Performs troubleshooting on CI catalogs. |
|
Diagnoses disk subsystem issues (used by SCOM). |
|
Troubleshoots log growth (used by SCOM). |
|
Uninstalls the anti-spam agents. |
|
Updates the malware filter definitions. |
Scripts may be added to this directory as you install rollup updates and service packs, and some of them will only be present when a specific server role is installed. For example, the anti-spam scripts will only be available on mailbox servers. To view all the scripts in the $ExScripts
folder, run Get-ChildItem
$exscripts
–Filter
*.ps1
.