Exchange 2010 How To...


Exchange 2010 cmdlet summary


These are cmdlets which I've used in the past. This is not intended as a comprehensive list, but I do hope to include the most common cmdlets.

Exchange cmdlets are run from the Exchange Management Shell (EMS). Many of these take additional parameters to those shown, you can get full information about a given cmdlet using help (see below).

Add-MailboxFolderPermissions
Adds folder-level permissions for a mailbox.
Get-Command
Displays a full list of cmdlets.
Get-EmailAddressPolicy
Lists attributes for all email address policies. On its own justs shows the name, priority and recipient filter.
Get-EmailAddressPolicy | fl
Lists all the attributes for the email address policies.
Get-EmailAddressPolicy -Identity polName
Lists attributes for the named email address policy.
Get-ExchangeServer
Lists the attributes of all the domain servers in the Exchange organization.
Get-MailboxFolderPermission
Lists the permissions on a mailbox.
Get-MailboxStatistics mailbox
Lists information about a mailbox. Whilst this shows limited information it does include the last-login-time for the mailbox.
Get-MailboxStatistics -databse exchange-database-name
Lists information about all the mailboxes in the exchange database specified. (The name of the database can be found using Exchange Management Console, drill down to Microsoft Exchange → Microsoft Exchange On-Premises → Organization Configuration → Mailbox and then look under the "Database Management" tab. If you can't get the name of the database then an alternative is "Get-mailbox | Get-MailboxStatistics"

To list mailboxes in descending order by when they were last accessed (so oldest ones are at the bottom of the list), use:

Get-MailboxStatistics -database "your exchange db name" | sort LastLogonTime -descending

or

Get-Mailbox | Get-MailboxStatistics | sort LastLogonTime -descending

Be aware that if a mailbox assistant accesses a mailbox then it will cause this date to be updated, so it is possible that a user has left but the above implies that their mailbox is still active. I gather that since Exchange 2013 Microsoft have deprecated the use of LastLogonTime, possibly for this very reason.

To list mailboxes in ascending order by size (so largest at the bottom) use:

Get-MailboxStatistics -database "your exchange db name" | sort TotalItemSize | Format-Table DisplayName, TotalItemSize

or

Get-Mailbox | Get-MailboxStatistics | sort TotalItemSize | Format-Table DisplayName, TotalItemSize

Get-Help cmdlet
Shows help on the specified cmdlet.
Get-Help cmdlet -online
Opens a browser window to show the help information available on the cmdlet on the microsoft website.
Get-OfflineAddressBook
Lists and shows summary information for any offline address books.
Get-OffLineAddressBook | Format-List
Lists and shows full information for any offline address books.
Get-PublicFolderStatistics
Shows statistics on the size of any public folders.
Get-ReceiveConnector | fl name,MaxMessageSize
Will show the current "MaxMessageSize" for all of your connectors.
Get-Recipient
Lists all recipients, i.e. all those who can receive emails (be they user accounts or public folders).
New-SendConnector -Internet -Name "Name" -AddressSpace "*;5"
Create a new internet-facing send connector with the specified Name. The AddressSpace is of the form "dns-name;cost", so "*;5" means wildcard or all destinations, with a cost of 5. The cost is only used if there are multiple connectors.
Set-ContentFilterConfig -BypassedSenders SmtpAddress
Will add the specified SmtpAddress to the list of sending email addresses that are not checked by the content filter. So it whitelists the smtp/email address given.
Set-ContentFilterConfig -BypassedSenderDomains SmtpDomain
Add the specified SmtpDomain to the list of sending email domains that are not checked by the content filter.
Set-EmailAddressPolicy
Used to set an attribute on a named address policy.

Any changes need to be saved using Update-EmailAddressPolicy to save any changes.

Set-MailboxFolderPermission
Sets folder-level permissions for a mailbox. Similar to Add-MailboxFolderPermission except that this modifies an existing permission.
Set-ExchangeServer server -ProductKey xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
Enters the Exchange product key for the specified server.
Set-ReceiveConnector "connector-name" -MaxMessageSize 20MB
Will set the MaxMessageSize for the named connector to 20MB.
Set-TransportConfig -MaxReceiveSize 40MB -MaxSendSize 20MB
Will set the organisation transport MaxSendSize (to 20MB) and MaxReceiveSize (to 40MB).
Set-TransportServer server -MessageExpirationTimeout dd.hh:mm:ss
Will set the message expiration timeout on the specified server to "dd" days, "hh" hours, "mm" minutes and "ss" seconds. This allows greater precision over the timeout than the Exchange Management Console which only allows the timeout to be specified in whole numbers of days.
Remove-MailboxFolderPermission
Removes permissions on a mailbox folder.
Update-EmailAddressPolicy -Identity policy
Saves and applkies any changes made to the named email address policy.
Update-GlobalAddressList -Identity "Default Global Address List" [-DomainController "Exchange-Server"]
Will update the global address list. You only need to specify the server if you have more than one Exchange server.
help cmdlet
Same as get-help. Shows help on the specified cmdlet.
cmdlet -?
Same as help cmdlet.

 


These notes have been tested with Exchange Server 2010.



About the author: is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.