Important Exchange PowerShell commands
I mention the commands listed in this appendix somewhere in the book, so
they must be reasonably important. If youre missing a PowerShell command
that you think you need, check the PowerShell Community Extensions site
at http://www.codeplex.com/PowerShellCX/Release/ProjectReleases.aspx to
see all the commands that people have created and shared. You may find the
command of your dreams there!
B.1 Recipient management commands
Get-Command Query all of the shell commands available (including standard
Windows PowerShell commands)
Get-ExCommand Query all of the Exchange 2007 shell commands that are available.
Get-ExCommand *Connector* reports all of the shell commands
that mention “Connector” in their name
New-Mailbox Creates a new mailbox (see Chapter 4 for examples)
Set-Mailbox Sets properties on an existing mailbox
Get-Mailbox Retrieves properties of an existing mailbox
Get-Mailbox –id Redmond retrieves properties of Redmond’s mail-
Get-Mailbox –server ‘XYZ1’ retrieves all mailboxes on server XYZ1
Disable-Mailbox Disables a mailbox
Disable-Mailbox –id ‘Jane Smith
Remove-Mailbox Removes a mailbox and its Active Directory object
Remove-Mailbox –id ‘Jane Smith
988 B.1 Recipient management commands
Connect-Mailbox Reconnect a disconnected mailbox with an Active Directory
Connect-Mailbox –id ‘Smith, JP’ –User JPSmith
Restore-Mailbox Restore information from a mailbox in a database mounted in a
Recovery Storage Group.
Restore-Mailbox –Id ‘Redmond’-RSGDatabase ‘ExchMbxSvr1\
Recovery Storage Group\VIP Mailboxes
Get-MailboxStatistics Returns mailbox statistics for a server, database, or mailbox
Get-MailboxStatistics –id Redmond
Get-MailboxStatistics –Server ExchMbxSvr1
Get-MailboxStatistics –Database ‘VIP Mailboxes
Move-Mailbox Moves a mailbox to another database or server. You can pass the –
ConfigurationOnly parameter to update the mailbox information
in Active Directory without moving the mailbox contents.
Move-Mailbox –id Redmond –TargetDatabase ‘ExchMbxSvr3\VIP
Add-MailboxPermission Assign permission to a user over a mailbox. For example, to allow a
user to open another user’s mailbox
Get-MailboxPermission Retrieves details about permissions held over a mailbox
Set-MailboxCalendarSettings Set calendar properties on a room mailbox
Get-MailboxCalendarSettings Retrieves information about the calendar properties on a room
Get-MailboxCalendarSettings –id ‘Liffey Room
Set-ResourceConfig Set resource configuration on an equipment mailbox
Set-ResourceConfig –ResourcePropertySchema (“Room/TV”,
“Room/Concall”, “Room/Couch”, “Room/Whiteboard”, “Equip-
ment/VCR”, “Equipment/ComfortableChairs”)
Get-Recipient Returns a full set of properties for Active Directory recipient
Get-Recipient –RecipientType MailUniversalSecurityGroup
New-Mailcontact Creates a new mail-enabled contact
Get-Mailcontact Retrieves the properties of a mail-enabled contact
Get-MailContact –id Smith
Set-MailContact Sets properties on a mail-enabled contact
Set-MailContact –id Smith –UseMapiRichTextFormat Always
B.1 Recipient management commands 989
Appendix B
Remove-MailContact Deletes a mail-enabled contact
Remove-MailContact –id Smith
Enable-MailContact Mail-enables an existing Active Directory contact
Enable-MailContact –id ‘JFS’
–ExternalMailAddress ‘jfs@xyz.com
Disable-MailContact Disable a mail contact by removing the Exchange attributes. The
contact reverts to being a “normal” contact
Disable-MailContact –id ‘JFS’
New-DistributionGroup Creates a new distribution group
Set-DistributionGroup Sets properties on a distribution group
Set-Distribution Group –id ‘Senior Executives’ –ExpansionServer
Get-DistributionGroup Retrieves properties of a distribution group
Remove-DistributionGroup Deletes a distribution group
Remove-DistributionGroup –id ‘Senior Executives
Get-DistributionGroupMember Retrieves the membership of a distribution group
Get-DistributionGroupMember -id ‘Senior Executives
New-DynamicDistributionGroup Creates a new dynamic distribution group
Set-DynamicDistributionGroup Sets properties on a dynamic distribution group
Set-DynamicDistributionGroup –id ‘Irish Employees’ –
CustomAttribute1 ‘Important’
Get-DynamicDistributionGroup Retrieves properties of a dynamic distribution group
Get-DynamicDistributionGroup –id ‘Irish Employees’ | Format-
Deletes a dynamic distribution group
Remove-DynamicDistributionGroup –id ‘Company Users
Set-CasMailbox Sets properties of a mailbox for a Client Access Server
Set-CasMailbox –id Redmond
–ActiveSyncMailboxPolicy ‘Mobile Users’
Get-CasMailbox Retrieves properties of a mailbox from a Client Access server
Get-CasMailbox –id Redmond | Format-List
Export-Mailbox Exports the contents of a mailbox to another mailbox.
Export-Mailbox –id ‘Jane Smith’ –TargetMailbox ‘Legal Review’ –
TargetFolder ‘Reviews’

Get Microsoft Exchange Server 2007: Tony Redmond's Guide to Successful Implementation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.