Exchange shell cmdlets Reference

Exchange Server administration forum
Post Reply
ManU
Founder
Founder
Posts: 98
Joined: Sat Sep 26, 2009 9:57 am
Location: India
Contact:

Exchange shell cmdlets Reference

Post by ManU » Mon Jan 18, 2010 8:57 pm

Common Cmdlet Actions

Get
- retrieves a specific object, such as a specific mailbox
- retrieves all objects of a specific type, such as mailboxes, distribution groups, or contacts
- retrieves a subset of objects of a specific type, such as mailboxes in a particular OU

Set
-modifies settings of an object, such as the alias of a contact

New
-creates a new object such as a new mailbox, a new mailbox database, or a new SMTP connector.

Remove
-removes an object, such as a mailbox or transport rule.

Enable
-enables an object, such as a transport rule, or mail-enables a recipient.

Disable
-disables an enabled object or mail-disables a recipient.

Parameters & Switches

Identity
-Identifies the unique object for the task. It is typically used with Enable, Disable, Remove, Set, and Get cmdlets.
Eg. Get-Mailbox -Identity user1

WhatIf
-allows you to view changes that would occur without actually applying them. The default value is $True.

Confirm
-causes the cmdlet to pause processing and requires the administrator to acknowledge what the cmdlet will do before processing continues. The default value is $True. To override confirmation for cmdlets that require a confirmation by default, set it to $False

Validate
-causes the cmdlet to check that all prerequisites for running the operation are satisfied and it will complete successfully.

Usage

Get-Command
-lists all cmdlets available through the shell— Exchange Server 2007 as well as Windows PowerShell cmdlets.

Get-Command
*keyword*

-lists all cmdlets that have keyword in the cmdlet.

Get-task | Get-Member
-lists all properties and methods of task.

Get-task | Format-List
-displays the output of the query in a formatted list.
Eg.Get-Mailbox *john* | Format-List alias,*quota

Help task
-retrieves shell help for a cmdlet
Eg. Help Get-Mailbox

Help task<TAB>
-Enter a partial name for task, and then press the TAB key to cycle through all cmdlets that contain the specified text. You can also use wildcard characters
Eg.Help *UM*

Get-task | Format-List > filename.txt
-exports the output of task to a text file: filename.txt

Recipients-Contacts

Enable-Mailcontact -Identity "John Smith” -alias smith -externalEmailAddress smith@contoso.com
-mail-enables the contact John Smith by specifying the distinguishedName (DN) for the contact, and providing the alias smith and an external email address smith@contoso.com.

Disable-MailContact -Identity smith
-mail-disables the contact by specifying the alias of the contact in the Identity parameter.

Set-MailContact -Identity smith -Alias jsmith
-changes the alias of the mail-enabled contact specified in the Identity parameter from smith to jsmith by using the Alias parameter.

Set-Contact -Identity jsmith -Manager user1
-modifies the contact jsmith’s manager attribute in Active Directory® to User1.

Recipients-Distribution Groups

Enable-DistributionGroup -Identity “contoso\Distribution Group” -Alias DG
-mail-enables the existing universal distribution group named Distribution Group in the contoso domain. It has the alias DG.

Disable-DistributionGroup -Identity DG
-mail-disables the mail-enabled universal distribution group named DG.

Set-DistributionGroup -Identity DG -Alias group1
-modifies the settings of the universal distribution group named DG in Exchange by changing its alias to group1.

Add-DistributionGroupMember -Identity DG -Member user1
-adds the recipient user1 as a member of the universal distribution group DG.

Get-DistributionGroupMember -Identity DG
-retrieves all the members of the distribution group named DG.

Set-Group -Identity DG -DisplayName “Universal DG”
-modifies the Active Directory settings of the group named DG by changing its display name to "Universal DG".

New-DynamicDistributionGroup -Name DDG -Alias DDGAlias -OrganizationalUnit OU -IncludedRecipients MailboxUsers
-creates a dynamic distribution group named DDG. The IncludedRecipients parameter accepts the following values: None | MailboxUsers | Resources | MailContacts | MailGroups | | MailUsers | AppRecipients.

Set-DynamicDistributionGroup -Identity DDG -DisplayName DDG1
-modifies the display name of the dynamic distribution group named DDG1 by changing the name to DDG1.

Recipients-Mailbox Management

Enable-Mailbox -Identity contoso\user1 -Database MailboxDatabase
-mailbox-enables an existing Active Directory user with the domain and alias combination contoso\user1 by creating a mailbox in the mailbox database named MailboxDatabase.

Disable-Mailbox -Identity user1
-mailbox-disables the user with the alias user1 by removing its associated mailbox.

Set-Mailbox -Identity user1 -alias user2
-modifies a mailbox by changing the existing alias user1 to user2.

Get-Mailbox | Format-Table alias, *quota
-retrieves all mailbox users and formats the output as a table to include the alias of the mailbox and the mailbox quotas.

Get-Mailbox -Database "Mailbox Database"
-retrieves a summary list of all mailboxes in the mailbox database named Mailbox Database.

Get-Mailbox -Server EXCH01
-retrieves a summary list of all mailboxes on the server named EXCH01.

Get-MailboxStatistics -Database MailboxDatabase
-retrieves the mailbox statistics for all mailboxes in the mailbox database named MailboxDatabase.

Get-MailboxStatistics -Server EXCH01
-retrieves the mailbox statistics for all mailboxes on the server named EXCH01.

Move-Mailbox -Identity user1 -TargetDatabase Server\MailboxDatabase
-moves the mailbox associated with the alias user1 to the server named Server. The mailbox is moved to the mailbox database named MailboxDatabase.
Thanks
MANU PHILIP
Microsoft MVP(Exchange Server)
| MCITP | MCTS | MCSA | ITIL V3 |
TechNet Forums Profile: ManU

tunhaati
Rank1
Rank1
Posts: 1
Joined: Mon Jan 30, 2012 11:22 am

Re: Exchange shell cmdlets Reference

Post by tunhaati » Tue Jan 31, 2012 1:19 pm

What is the difference between a regular mailbox and express mailbox? I'm sending a regular letter to a friend and I put a regular 42 cents stamp on it n I accidentally put it in the express mailbox. Will they send me the letter back or will they just send it normally because I did have a regular stamp on it. Help?

ManU
Founder
Founder
Posts: 98
Joined: Sat Sep 26, 2009 9:57 am
Location: India
Contact:

Re: Exchange shell cmdlets Reference

Post by ManU » Tue Jan 31, 2012 10:43 pm

Thanks
MANU PHILIP
Microsoft MVP(Exchange Server)
| MCITP | MCTS | MCSA | ITIL V3 |
TechNet Forums Profile: ManU

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest