Exchange Management Shell Tips of the Day
Microsoft Exchange Server 2007 will reach end of support on April 11, 2017. To stay supported, you will need to upgrade. For more information, see Resources to help you upgrade your Office 2007 servers and clients.
Applies to: Exchange Server 2007, Exchange Server 2007 SP1, Exchange Server 2007 SP2, Exchange Server 2007 SP3
This topic lists all the Exchange Management Shell Tips of the Day and points to related Microsoft Exchange Server 2007 Help topics or other appropriate Microsoft documentation. Tips of the Day are displayed every time that you open the Exchange Management Shell
To view a tip of the day on-demand, open the Exchange Management Shell and run the Get-Tip cmdlet.
Tip | Related topics |
---|---|
Did you know that the Identity parameter is a "positional parameter"? That means you can use:
It's a neat usability shortcut! |
|
To return all scripts that are found in your path, type:
And for a useful shortcut, assign it in your profile as:
|
|
Are you tired of typing a long command every time that you want to do something? Alias it! Type:
For all the current aliases, type:
|
|
Do you want to export mailbox data directly to a .pst file? Use the Export-Mailbox cmdlet. You can even export multiple mailboxes with one command. Type:
You can also import .pst files into mailboxes by using the Import-Mailbox cmdlet. Type:
|
|
Do you want to see the members of a dynamic distribution group that has a custom filter? Just use the Get-Recipient cmdlet. Type:
|
|
The Exchange Management Shell is a calculator too! Try it directly in the command line:
|
|
Command line 911! Do you need help? Type:
You can also perform wildcard character searches and partial name matches:
And you can get more details about a cmdlet by using:
|
|
A quick shortcut to get all the parameters for a cmdlet is:
or abbreviated:
|
|
The tilde character (
You can use it as a useful shortcut:
|
|
Do you want to move mailboxes? Type:
You can move all users from server SRV1 to server SRV2 as follows:
|
|
CTRL+C is the equivalent of the hard-break command in the Exchange Management Shell. If a command is taking too long to run or you want to cancel an operation quickly, press CTRL+C to stop execution. |
|
Pushd and Popd work the same way in the Exchange Management Shell as they do in cmd.exe. Type:
|
|
XML over everything! The Exchange Management Shell treats XML as a native type, so that you can do interesting things like:
This command assigns
To navigate it, type:
No need for text parsing when you want to load XML data! |
|
Cmdlets that end in "Config" manage singleton configuration, either one per server or organization. For these tasks, you don't have to specify an identity because there is only one instance of the configuration. You may have to specify the Server parameter if the configuration is per server. |
|
To get a list of all users on an Exchange 2007 server who are not Unified Messaging-enabled type, use:
|
|
To get a list of all users on an Exchange 2007 server who are Unified Messaging-enabled type, use:
|
|
To display the user's alias formatted in a table together with the user's Exchange 2007 server name and telephone extension, type:
|
|
To display the list of UM IP gateway server names that are disabled for outbound calling and hunt groups that are associated with a UM IP gateway server, use:
|
|
If you want to test all IP Block List providers, you just have to pipe the Get-IpBlockListProvider cmdlet to the Test-IpBlockListProvider cmdlet:
|
|
Before you remove an object by using the Remove verb, use the WhatIf parameter to verify the results are what you expect. |
|
Sometimes it's useful to convert the output of a cmdlet to a string to interoperate with native cmdlets. For example, type:
|
|
Get all Win32 WMI information, such as perfmon counters and local computer configurations. For example, type:
|
|
Tired of spam? Who isn't? You can configure real-time block list (RBL) providers with the Exchange Management Shell by running the following two commands:
and then
|
|
Access the event log from the Exchange Management Shell. To retrieve the whole event log, run:
To retrieve all Exchange-related events, run:
|
|
One benefit of the Exchange Management Shell is that cmdlets can emit objects to the console. You can then manipulate this output and organize it in interesting ways. For example, to get a quick view in tabular format, use Format-Table:
|
|
Did you forget a property name? Not a problem because you can use wildcard characters to retrieve all properties that match the part of the name that you specify:
|
|
Do you want to work with data that is contained in a CSV file? Use Import-CSV to assign the data to an object. For example, type:
You can then manipulate the data easily in the Exchange Management Shell. For example, if there is a column called To sort: To group: |
|
This command spins through all your mailbox servers and reconnects all the uniquely identified but disconnected mailboxes in any one of the mailbox stores:
|
|
Tab completion reduces the number of keystrokes that are required to complete a cmdlet. Just press the TAB key to complete the cmdlet you are typing. Tab completion kicks in whenever there is hyphen (-) in the input. For example:
should complete to Get-SendConnector. You can even use regular expressions, such as:
Pressing the TAB key when you enter this command cycles through all cmdlets that match the expression, such as the Unified Messaging Mailbox policy cmdlets. |
|
Do you want to create a group of test users in your lab? Use this command:
|
|
Do you want to change the authentication settings on an Outlook Web Access virtual directory? Try the following command as an example. It changes authentication from forms-based authentication to Windows authentication:
|
|
Do you want to set the properties on all or some Outlook Web Access virtual directories? Pipe the output of Get-OwaVirtualDirectory to the Set-OwaVirtualDirectory cmdlet. For example, the following command sets the Gzip level for all Outlook Web Access virtual directories:
|
|
Do you want to remove an ActiveSync device from a user's device list? Type:
This cmdlet can be helpful for troubleshooting devices that do not synchronize successfully with the server. |
|
Do you want to clear all data from a mobile device? Use:
Specify a time of day to clear the device, or let the task complete the next time that the device connects to the server. |
|
Do you want to see a list of all devices that synchronize with a user's mailbox? Type:
A variety of information is returned including device name, operating system, and last sync time. |
|
Has one of your users asked you to recover their mobile device synchronization password? To return the user's password, type:
|
|
Do you want to move the storage group path to another location? Type:
To change only the path setting without moving data, use this command together with the ConfigurationOnly parameter. This command is especially useful for disaster recovery. Warning Misuse of this cmdlet will cause data loss. |
|
Do you want to move your database path to another location? Type:
To change the file path setting without moving data, use this command together with the ConfigurationOnly parameter. This command is especially useful for disaster recovery. Warning Misuse of this cmdlet will cause data loss. |
|
To set the dial restrictions on a specific Unified Messaging dial plan, type:
|
|
Do you need an easy way to add a new primary SMTP address to a group of mailboxes? The following command creates a new e-mail address policy that assigns the
|
|
Do you want to retrieve a group of objects that have similar identities? You can use wildcard characters with the Identity parameter to match multiple objects. Type:
|
|
Do you want to configure a group of objects that have similar identities? You can use a wildcard characters with the Identity parameter when you use a Get cmdlet and pipe the output to a Set cmdlet. Type:
This command matches all mailboxes with the name "John" in the mailbox's identity and set the ProhibitSendQuota parameter to |
|
Most cmdlets let you pass the output of one noun to another noun in order to view or modify related objects. For example, you might want to set the mailbox limit on all mailboxes that reside in a specific mailbox database on a server. You can do this by using this command:
This command retrieves all the mailboxes that reside in the "Executives" mailbox database and sets their ProhibitSendQuota value to |
|
Forgot what the available parameters are on a cmdlet? Just use tab completion! Type:
When you type a hyphen (
|
|
Say goodbye to ping. Say hello to Test-MapiConnectivity! Use Test-MapiConnectivity to troubleshoot connectivity problems between your users and your servers. Combine Test-MapiConnectivity with a variety of cmdlets to target your specific issue without having to manually dig for the information: Mailboxes: Mailbox databases: Servers: |
|
Do you want to add an alias to multiple distribution groups that have a similar name? Type:
This command adds the alias "kim" to all distribution groups that contain the word "Exchange". |
|
Do you want to record exactly what happens when you're using the Exchange Management Shell? Use the Start-Transcript cmdlet. Anything that you do after you run this cmdlet will be recorded to a text file that you specify. To stop recording your session, use the Stop-Transcript cmdlet. Notice that the Start-Transcript cmdlet overwrites the destination text file by default. If you want to append your session to an existing file, use the Append parameter:
|
|
Here's a handy tip for repeating a command a given number of times. Instead of writing a For loop, use the following syntax:
For example, the following command creates 10 new storage groups that have the names
|
|
Do you want to know when your mailbox databases were backed up last? Type:
|
|
Do you want to move all the mailboxes from one mailbox database to another? You can do this easily by using the following command:
You can even use wildcard characters with the Get-MailboxDatabase cmdlet to consolidate mailboxes from multiple source mailbox databases into a single destination mailbox database. |
|
Do you have a user who has network access but maintains an external mail account outside your Exchange organization? With Exchange Server 2007, you can now create mail-enabled users that are regular Active Directory accounts, but also behave like mail-enabled contacts. By using the Enable-MailUser cmdlet, you can add e-mail contact attributes to any existing Active Directory user who does not already have a mailbox on an Exchange server. Users in your Exchange organization will then be able to send e-mail messages to that user's external mail account. Type:
|
|
Do you want to change the default prohibit send quota for a mailbox database? Type:
You can specify a bytes qualifier when you use the ProhibitSendQuota parameter. For example, if you want to set the prohibit send quota to 200 megabytes, type:
You can also configure the IssueWarningQuota parameter and the ProhibitSendReceiveQuota parameter in the same way. |
|
Do you want to know what version of Exchange Server each of your servers is running? Type:
|
|
Do you want to know which Exchange 2007 servers have not yet been configured with a valid product key and whether their trial period has expired? Type:
|
|
Do you want to determine whether a server is running Exchange Server 2007 Standard Edition or Exchange Server 2007 Enterprise Edition? Type:
If you want to view which edition all your Exchange servers are running, omit the <Server Name> parameter. |
|
Do you want to create a new resource mailbox that can be used to book a meeting room? Type:
This command creates a disabled Active Directory user who has a mailbox that accepts meeting requests from users. |
|
Do you want to add a disclaimer to all outbound e-mail messages? Type:
|
|
Do you want to control the properties of e-mail messages sent to a specific domain? Use the RemoteDomain cmdlets. Create a new remote domain by using the
Then modify the properties that you want for this remote domain by using the Set-RemoteDomain cmdlet:
|
|
You can control which features are available to Outlook Web Access users by using the Set-OwaVirtualDirectory cmdlet. Type:
|
|
Booleans are parameters that can be evaluated as either
|
|
Do you want to remove all e-mail messages that were sent from a certain domain name from a server's queues without generating a non-delivery report (NDR)? Type:
|
|
Do you want an easy way to apply deleted item retention limits across multiple databases and servers? Try the following command to configure deleted item retention across all databases on a specified server:
You can also apply the same deleted item retention limits or mailbox retention limits across all servers in your organization:
|
|
Do you want to know what permissions an Active Directory user account has on a specific mailbox? Use:
|
|
Do you want to know which mailboxes a specific Active Directory user has permissions to? Type:
Caution: This command enumerates all the mailboxes in your organization. If you have lots of mailboxes, you may want to target specific mailboxes. |
|
Do you want to get a list of the backup status of all mailbox databases in your organization? Type:
How about just the mailboxes on a specific server? Type:
|
|
To retrieve the current status of an Exchange server or database, use the Status parameter. For example:
|
|
Do you want to view the mounted status of all mailbox databases? Type:
|
|
What's the difference between server-side filtering and client-side filtering? Server-side filtering is used with the recipient and queue cmdlets, which support the Filter parameter, because these cmdlets can return large result sets. The server filters the results by using the criteria you specify, and then sends you the filtered results. Client-side filtering can be used with any cmdlet. The entire result set is sent to the client computer, which then filters the data and provides a filtered result set. Client-side filtering uses the Where-Object cmdlet, which can be shortened to Where. |
|
With Exchange Server 2007 Unified Messaging (UM), you can redirect unauthenticated callers to certain telephone extensions to an operator instead of to the extension that was dialed. To list users for whom UM transfers unauthenticated callers to the operator, instead of to the user, type:
|
|
You can use client-side filtering to return only the data that you want to see or work with. The following example retrieves all Active Directory user accounts that are in the Engineering department and puts the results in a table with two columns,
|
|
The special variable
|
|
You can import CSV files and treat them as objects by using the Import-Csv cmdlet. Each row in a CSV file becomes an element in an array, and each column becomes a property. You can assign the CSV file to a variable or you can pipe its contents directly to another cmdlet. In the following example, there are three columns in the CSV file,
|
|
Do you want to customize your Exchange Management Shell profile? Run the following command to determine the location of your Microsoft.PowerShell_profile.ps1 file is:
You may have to create the |
|
Use the following commands to configure a managed folder policy that will enforce a maximum personal e-mail folder size of
|
|
Do you want to see everything that occurs when you run a command? Include the Verbose parameter with the command. This parameter instructs the Exchange Management Shell to display detailed information about each action that the server takes to complete the command. This information can be useful in troubleshooting. |
|
Any cmdlet that accepts a size value lets you specify whether the integer value is in kilobytes (KB), megabytes (MB), gigabytes (GB), or terabytes (TB). For example:
|
|
The Exchange Management Shell can log all the Exchange-related commands that modify objects in some way. Exchange-related command activity is logged to the PowerShell event log. To enable Exchange-related command logging, run the following command:
|
|