Topic Last Modified: 2010-06-25

Exchange 2010 Shell Quick Reference

This quick reference sheet describes the most frequently used cmdlets available in the release to manufacturing (RTM) and later versions of Microsoft Exchange Server 2010 and provides examples of their use.

For more information about the Exchange Management Shell in Exchange 2010 and all the available cmdlets, see the following topics:

What would you like to learn about?

Common Cmdlet Actions

The following verbs are supported by most cmdlets and are associated with a specific action.

New

The New verb creates an instance of something, such as a new configuration setting, a new database, or a new SMTP connector.

Remove

The Remove verb removes an instance of something, such as a mailbox or transport rule.

All Remove cmdlets support the WhatIf and Confirm parameters. For more information about these parameters, see Important Parameters.

Enable

The Enable verb enables a setting or mail-enables a recipient.

Disable

The Disable verb disables an enabled setting or mail-disables a recipient.

All Disable tasks also support the WhatIf and Confirm parameters. For more information about these parameters, see Important Parameters.

Set

The Set verb modifies specific settings of an object, such as the alias of a contact or the deleted item retention of a mailbox database.

Get

The Get verb queries a specific object or a subset of a type of object, such as a specific mailbox, all mailbox users, or mailbox users in a domain.

Return to top

Important Parameters

The following parameters help you control how your commands run and indicate exactly what a command will do before it affects data.

Identity

The Identity parameter identifies the unique object for the task. It's typically used with Enable, Disable, Remove, Set, and Get cmdlets. Identity is also a positional parameter, which means that you don't have to specify Identity when you specify the parameter's value on the command line.

For example, Get-Mailbox -Identity user1 queries for the mailbox of user1. Get-Mailbox user1 is equivalent to Get-Mailbox -Identity user1.

WhatIf

The WhatIf parameter instructs the cmdlet to simulate the actions that it would take on the object. By using the WhatIf parameter, you can view what changes would occur without actually applying any of the changes. The default value is $true.

Confirm

The Confirm parameter 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.

Validate

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

Return to top

Tips and Tricks

The following commands are associated with various tasks that you can use when administering Exchange 2010.

Get-Command

This cmdlet retrieves all tasks that can be executed in Exchange 2010.

Get-Command *keyword*

This cmdlet retrieves tasks that have keyword in the cmdlet.

Get-task | Get-Member

This cmdlet retrieves all properties and methods of task.

Get-task | Format-List

This cmdlet displays the output of the query in a formatted list. You can pipe the output of any Get cmdlet to Format-List to view the whole set of properties that exist on the object returned by that command, or you can specify individual properties that you want to view, separated by commas, as in the following example: Get-Mailbox *john* | Format-List alias,*quota

Help task

This cmdlet retrieves Exchange Management Shell help information for any task in Exchange 2010, as in the following example: Help Get-Mailbox

Get-task | Format-List > file.txt

This cmdlet exports the output of task to a text file: file.txt

Return to top

Recipients

The following sections provide information about recipients that you can use when administering Exchange 2010.

Contact Management

Enable-MailContact -Identity "John Smith" -Alias smith -ExternalEmailAddress smith@contoso.com

This command mail-enables the contact John Smith by specifying the distinguished name (DN) for the contact, and providing the alias smith and an external e-mail address smith@contoso.com.

Disable-MailContact -Identity smith

This command mail-disables the contact by specifying the alias of the contact in the Identity parameter.

Set-MailContact -Identity smith -Alias jsmith

This command 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

This command modifies the Active Directory information of contact jsmith by changing the jsmith manager to user1.

Note:
If the contact isn't mail-enabled, you can't retrieve it by using an alias. You must use the contact's full name, GUID, or DN.

Return to top

Group Management

Enable-DistributionGroup -Identity “contoso\Distribution Group" -Alias DG

This command mail-enables the existing universal distribution group named Distribution Group that's in the contoso domain and has the alias DG.

Disable-DistributionGroup -Identity DG

This command mail-disables the mail-enabled universal distribution group named DG.

Set-DistributionGroup -Identity DG -Alias group1

This command modifies the settings of the universal distribution group named DG in Exchange by changing its alias to group1.

Add-DistributionGroupMember -Identity DG -Member user1

This command adds the recipient user1 as a member of the universal distribution group DG.

Get-DistributionGroupMember -Identity DG

This command retrieves all the members of the distribution group named DG.

Set-Group -Identity DG -DisplayName “Universal DG"

This command modifies the Active Directory settings of the Microsoft Windows group named DG by changing its display name to Universal DG.

New-DynamicDistributionGroup -Name DDG -Alias DDGAlias -OrganizationalUnit OU -IncludedRecipients MailboxUsers

This command creates a query-based dynamic distribution group named DDG that's in the organizational unit OU and has the alias DDGAlias. The IncludedRecipients parameter accepts the following values: None | MailboxUsers | Resources | MailContacts | MailGroups | MailUsers | AllRecipients.

Set-DynamicDistributionGroup -Identity DDG -DisplayName DDG1

This command modifies the display name of the dynamic distribution group named DDG by changing the name to DDG1.

Return to top

Mailbox Management

Enable-Mailbox -Identity contoso\user1 -Database MailboxDatabase

This command 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.

Note:
If you don't specify a database, one will be chosen for you.

Disable -Mailbox -Identity user1

This command mailbox-disables the user with the alias user1 by removing its associated mailbox. The user isn't deleted.

Set-Mailbox -Identity user1 -Alias user2

This command modifies a mailbox by changing the existing alias user1 to user2.

New-MailboxExportRequest -Mailbox AylaKol -FilePath "\\MBX-01\PSTFileShare\Ayla_Recovered.pst"

This command retrieves the contents of the mailbox with the alias AylaKol and stores the PST file in \\MBX-01\PSTFileShare\Ayla_Recovered.pst.

Note:
The New-MailboxExportRequest cmdlet is available only in Exchange 2010 Service Pack 1 (SP1).

Dir \\SERVER01\PSTshareRO\Recovered\*.pst | %{ New-MailboxImportRequest -Name RecoveredPST -BatchName Recovered -Mailbox $_.BaseName -FilePath $_.FullName -TargetRootFolder SubFolderInPrimary}

This command imports all the .pst files in the shared folder \\SERVER01\PSTshareRO\Recovered. Each .pst file name is named after a corresponding user's alias. The command creates an import request named RecoveredPST for all the .pst files and imports the data into the matching mailbox.

Note:
The New-MailboxImportRequest cmdlet is available only in Exchange 2010 SP1.

Get-Mailbox | Format-Table alias, *quota

This command retrieves all mailbox users and formats the output to include the alias of the mailbox and the mailbox quotas.

Get-Mailbox -Database MailboxDatabase

This command retrieves a summary list of all mailboxes in the mailbox database named MailboxDatabase.

Get-Mailbox -Server Server

This command retrieves a summary list of all mailboxes on the server named Server.

Get-MailboxStatistics -Database MailboxDatabase

This command retrieves the mailbox statistics for all mailboxes that are located in the mailbox database named MailboxDatabase.

Get-MailboxStatistics -Server Server

This command retrieves the mailbox statistics for all mailboxes that are located on the server named Server.

New-MoveRequest -Identity 'user1'-TargetDatabase Executives

This command creates a move request for the mailbox associated with the alias user1 to the mailbox database named Executives.

Get-MoveRequest

This command retrieves a list of all the move requests that are in progress and displays the status of each one.

Get-MoveRequestStatistics -Identity user1

This command retrieves the mailbox move statistics for the mailbox user1.

Return to top

Customizable Mailbox Quota Messages

New-SystemMessage -QuotaMessageType ProhibitSendMailbox -Text "Prohibit Send Mailbox Quota Message Text" -Language En

This command creates a customized quota message for the ProhibitSendMailbox quota message type. The text "Prohibit Send Mailbox Quota Message Text" is displayed in English, as specified by the locale code En. The valid values for the QuotaMessageType parameter are WarningMailboxUnlimitedSize, WarningPublicFolderUnlimitedSize, WarningMailbox, WarningPublicFolder, ProhibitSendMailbox, ProhibitPostPublicFolder, and ProhibitSendReceiveMailbox.

Set-SystemMessage En\ProhibitSendMailbox -Text "New Prohibit Send Mailbox Quota Message Text"

This command modifies the existing customized quota message for the ProhibitSendMailbox quota message type that's displayed in English, as specified by the locale code En. The new text is "New Prohibit Send Mailbox Quota Message Text".

Get-SystemMessage En\ProhibitSendMailbox

This command retrieves the existing customized quota message for the ProhibitSendMailbox quota message type that's displayed in English, as specified by the locale code En.

Remove-SystemMessage En\ProhibitSendMailbox

This command removes the existing customized quota message for the ProhibitSendMailbox quota message type that's displayed in English, as specified by the locale code En.

Return to top

Recipient

Get-Recipient -RecipientType UserMailbox

This command retrieves a summary list of all recipients that match the RecipientType UserMailbox. The RecipientType parameter accepts the following values: DynamicDistributionGroup | UserMailbox | MailContact | MailUniversalDistributionGroup | MailUniversalSecurityGroup | MailNotUniversalGroup | MailUser | PublicFolder.

Get-Recipient -Anr "user"

This command retrieves a summary list of all recipients that contain the string "user" in the mailbox name. The Anr parameter indicates that the argument will be resolved by using ambiguous name resolution (ANR).

Get-Recipient -ResultSize 100

This command retrieves a summary list of recipients and returns only the first 100 recipients.

Return to top

Unified Messaging

Get-UMMailbox

This command retrieves a summary list of all Unified Message (UM)-enabled recipients.

Get-UMMailbox -Identity user1 | Format-List

This command retrieves the detailed configuration of the UM mailbox that's associated with the alias user1.

Enable-UMMailbox -Identity tonysmith@contoso.com -UMMailboxPolicy MyUMMailboxPolicy -Extensions 51234 -PIN 5643892 -NotifyEmail administrator@contoso.com -PINExpired $true

This command enables Unified Messaging on the mailbox for tonysmith@contoso.com, sets the extension and PIN for the user, sets the PINExpired parameter to $true, sets the NotifyEmail parameter to administrator@contoso.com, and then assigns a UM mailbox policy named MyUMMailboxPolicy to the user's mailbox.

Return to top

User

Enable-MailUser -Identity contoso\user2 -ExternalEmailAddress user2@northwindtraders.com

This command mail-enables the Active Directory user contoso\user2 with an external address user2@northwindtraders.com. With this cmdlet, a default primary SMTP e-mail address user2@contoso.com is also created.

Disable-MailUser -Identity user2

This command mail-disables the Active Directory mail-enabled user user2.

Set-MailUser -Identity user2 -ExternalEmailAddress user2@research.northwindtraders.com

This command modifies the Active Directory mail-enabled user user2 by changing its external e-mail address to user2@research.northwindtraders.com

Return to top

Storage

The following section provides information about database management that you can use when administering Exchange 2010.

Database Management

New-MailboxDatabase -Name MailboxDatabase -Server ExServer1

This command creates a mailbox database named MailboxDatabase on the server ExServer1.

Set-MailboxDatabase -Identity MailboxDatabase -IssueWarningQuota 500MB

This command modifies the mailbox database MailboxDatabase by changing its mailbox warning quota limit to 500MB.

Get-MailboxDatabase -Server ExServer1

This command retrieves a summary list of all mailbox databases on the server named ExServer1.

Mount-Database -Identity MailboxDatabase

This command mounts the existing mailbox database named MailboxDatabase.

Dismount-Database -Identity MailboxDatabase

This command dismounts the existing mailbox database named MailboxDatabase.

Return to top

Transport

The following sections provide information about transport that you can use when administering Exchange 2010.

Connectors and Delivery

New-SendConnector -Name SendConnector -AddressSpaces contoso.com

This command creates an Internet Send connector named SendConnector. The associated address space for the Send connector is contoso.com.

Set-SendConnector -Identity SendConnector -AddressSpaces northwindtraders.com

This command modifies the Send connector named SendConnector by changing its address space to northwindtraders.com.

New-ReceiveConnector -Name ReceiveConnector -RemoteIPRanges 10.149.0.1-10.151.0.1 -Bindings 0.0.0.0:25

This command creates a Receive connector named ReceiveConnector. The associated remote IP range is 10.149.0.1 to 10.151.0.1. By setting the Bindings parameter to 0.0.0.0:25, you instruct the server to listen for connections on all locally configured IP addresses on port 25.

Set-ReceiveConnector -Identity ReceiveConnector -MaxMessageSize 20MB

This command modifies the Receive connector ReceiveConnector by changing the value of the MaxMessageSize parameter to 20MB.

Return to top

Queues

Suspend-Queue -Identity Server\Queue

This command stops all messages in queue Server\Queue from being delivered.

Resume-Queue -Identity Server\Queue

This command allows the suspended queue Server\Queue to resume delivery of messages.

Get-Message -Identity Server\Queue\Message

This command retrieves the specific message Server\Queue\Message.

Suspend-Message -Identity Server\Queue\Message

This command stops the message Server\Queue\Message in a queue from being delivered.

Get-Queue | Suspend-Queue

This command suspends all queues on the local server.

Resume-Message -Identity Server\Queue\Message

This command allows the suspended message Server\Queue\Message in a queue to be delivered.

Delete-Message -Identity Server\Queue\Message

This command deletes the specified message Server\Queue\Message.

Return to top

Address Rewriting

New-AddressRewriteEntry -Name RewriteEntryName -InternalAddress david@contoso.com -ExternalAddress support@contoso.com

This command creates the address rewrite entry named RewriteEntryName for the internal e-mail address david@contoso.com. All e-mail messages sent from david@contoso.com are rewritten to support@contoso.com, and all inbound messages to support@contoso.com are rewritten to david@contoso.com. This command can only be run on Edge Transport servers.

Set-AddressRewriteEntry -Identity RewriteEntryName -InternalAddress chris@contoso.com

This command modifies the existing address rewrite entry RewriteEntryName by changing the value of the InternalAddress parameter to chris@contoso.com. This command can only be run on Edge Transport servers.

Return to top

Anti-Spam

Set-RecipientFilterConfig -BlockedRecipients info@contoso.com, corp@contoso.com

This command modifies the recipient filtering configuration by replacing the existing blocked recipients list with info@contoso.com and corp@contoso.com.

Set-SenderFilterConfig -BlockedSenders badsender@northwindtraders.com

This command modifies the sender filtering configuration for spam by replacing the existing blocked senders list with badsender@northwindtraders.com.

Add-ContentFilterPhrase -Phrase "spam" -Influence BadWord

This command adds the phrase "spam" to the content filter by setting its Influence parameter to BadWord. The Influence parameter accepts the values BadWord and GoodWord.

Add-IPAllowListEntry -IPRange 127.1.0.0

This command adds the IP address 127.1.0.0 to the IP Allow list. The IP mask defaults to 255.255.255.255, or a CIDR block size of 0, because it isn't specified.

Add-IPAllowListEntry -IPRange "127.1.0.0/24"

This command adds the IP address 127.1.0.0, which has a CIDR block size of 24, to the IP Allow list,

Add-IPAllowListEntry -IPRange 127.1.0.0-127.1.255.255

This command adds an allowed range of IP addresses. In this case, the IP range is from 127.1.0.0 through 127.1.255.255.

Add-IPBlockListEntry -IPAddress 127.2.0.1

This command adds the IP address 127.2.0.1 to the IP Block list.

Test-IPAllowListProvider -Identity AllowListProvider -IPAddress 127.1.0.0

This command tests a specified IP address 127.1.0.0 to see whether it's listed as an allowed IP address with the IP Allow List provider IPAllowListProvider.

Add-IPAllowListProvider -Name Provider1 -LookupDomain www.contoso.com -IPAddressesMatch 127.1.0.0

This command adds an IP Allow List provider named Provider1, which is used to verify which IP addresses are allowed. The associated lookup domain is www.contoso.com, and the IP address that must match the result returned by the IP Allow List provider is 127.1.0.0.

Add-IPBlockListProvider -Name Provider2 -LookupDomain www.contoso.com -IPAddressesMatch 127.2.0.1

This command adds an IP Block List provider named Provider2, which is used to verify which IP addresses should be blocked. The associated lookup domain is www.contoso.com, and the IP address that must match the result returned by the IP Block List provider is 127.2.0.1.

Get-SenderIdConfig

This command retrieves the Sender ID configuration settings.

Add-AttachmentFilterEntry -Name image/jpeg -Type ContentType

This command adds an attachment filter entry that's used to block all JPEG attachments, based on the attachment's content type image/jpeg, regardless of the file name. This command can only be run on Edge Transport servers.

Add-AttachmentFilterEntry -Name *.EXE -Type FileName

This command adds an attachment file entry that's used to block all attachments that have the file name extension *.EXE. This command can only be run on Edge Transport servers.

Remove-AttachmentFilterEntry ContentType:image/jpeg

This command removes an attachment filter entry that's used to filter JPEG attachments based on the attachment's content type image/jpeg. This command can only be run on Edge Transport servers.

Remove-AttachmentFilterEntry FileName:*.EXE

This command removes an attachment filter entry that's used to filter all attachments that have the file name extension *.EXE. This command can only be run on Edge Transport servers.

Set-AttachmentFilterListConfig -RejectResponse "The attachment you included in your e-mail message was not allowed." -Action Reject

This command configures the Attachment Filter agent to reject all messages that contain filtered attachments. Both the attachment and e-mail message are blocked, and the configured text is used in the message body of the non-delivery report (NDR) that's sent to senders whose messages contain an attachment that's blocked. Available actions are Reject, Strip, and SilentDelete. This command can only be run on Edge Transport servers.

Return to top

Customizable DSN Messages

New-SystemMessage -DsnCode 5.7.0 -Text "DSN Message Text" -Internal $false -Language En

This command creates a customized Delivery Status Notification (DSN) message for the DSN code 5.7.0. The text of the DSN message is "DSN Message Text", the language the message is displayed in is English, specified by the locale code En, and the DSN message is sent to both internal and external senders.

Set-SystemMessage -Identity En\External\5.7.0 -Text "New DSN Message Text"

This command modifies the existing customized DSN message for the DSN code 5.7.0. The identity, En\External\5.7.0, consists of the language, specified by the locale code En, whether the DSN message scope is internal or external, and the DSN code. The text of the DSN message is changed to "New DSN Message Text".

Get-SystemMessage -Identity En\External\5.7.0

This command retrieves the existing customized DSN message for the DSN code 5.7.0 by using the identity En\External\5.7.0.

Get-SystemMessage -Original

This command retrieves a list of all built-in DSN messages.

Remove-SystemMessage -Identity En\External\5.7.0

This command removes the existing customized DSN message for the DSN code 5.7.0 by using the identity En\External\5.7.0.

Return to top

Policy and Compliance

The following sections provide information about policy and compliance that you can use when administering Exchange 2010.

Hub Transport Rules

New-TransportRule -Name "RuleName" -FromMemberOf "Executives" -SentTo "AllCompany" -ApplyClassification "ExecutiveCommunication"

This command creates the transport rule RuleName on a Hub Transport server. The rule applies the classification ExecutiveCommunication to all messages sent from members of the Executives distribution group and sent to the AllCompany distribution group.

Get-TransportRule -Identity RuleName | Format-List

This command retrieves the detailed configuration of the transport rule RuleName.

Remove-TransportRule -Identity RuleName

This command removes the transport rule RuleName.

Return to top

Journal Rules

New-JournalRule -Name "JournalRuleName" -Recipient MailboxToJournal@contoso.com -JournalEmailAddress "Journal Reports" -Scope Global

This command creates the journal rule JournalRuleName. Copies of all e-mail messages set to and from MailboxToJournal@contoso.com are sent to the mailbox Journal Reports as attachments within the journal message envelope. The journal rule is enabled upon creation. Valid values for the Scope parameter are Internal, External, and Global.

Set-JournalRule -Identity JournalRuleName -Recipient DistributionGroupToJournal@contoso.com

This command modifies the journal rule JournalRuleName by setting the value of the Recipient parameter to DistributionGroupToJournal@contoso.com.

Set-TransportConfig -JournalingReportNdrTo AltJournalReports@contoso.com

This command configures Exchange to redirect journal reports to AltJournalReports@contoso.com if the primary journaling mailbox is temporarily unavailable.

Return to top

Servers

Get-ExchangeServer

This command retrieves a summary list of all existing servers.

Get-ExchangeServer -Domain contoso.com

This command retrieves a summary list of all servers in the domain contoso.com.

Get-ExchangeServer -Status | Format-List

This command retrieves a detailed list of all existing servers and forces a call to update the server's current status. Without the Status parameter, some fields that change in real-time aren't populated.

Return to top

Permissions

Get-RoleGroupMember "Organization Management"

This command retrieves the members of the Organization Management management role group.

Get-ManagementRoleAssignment -Role "Mail Recipient Creation" -GetEffectiveUsers

This command retrieves a list of all the users who are granted permissions provided by the Mail Recipient Creation management role. This includes users who are members of role groups or universal security groups (USGs) that are assigned the Mail Recipient Creation role. This doesn't include users who are members of linked role groups in another forest.

Get-ManagementRoleAssignment -RoleAssignee Administrator | Get-ManagementRole | Get-ManagementRoleEntry

This command retrieves a list of cmdlets that the user Administrator can run.

ForEach ($RoleEntry in Get-ManagementRoleEntry *\Remove-Mailbox -parameters Identity) {Get-ManagementRoleAssignment -Role $RoleEntry.Role -GetEffectiveUsers -Delegating $False | Where-Object {$_.EffectiveUserName -Ne "All Group Members"} | FL Role, EffectiveUserName, AssignmentChain}

This command retrieves a list of all the users who can run the Remove-Mailbox cmdlet.

Get-ManagementRoleAssignment -WritableRecipient kima -GetEffectiveUsers | FT RoleAssigneeName, EffectiveUserName, Role, AssignmentChain

This command retrieves a list of all users who can modify the mailbox of kima.

New-ManagementScope "Seattle Users" -RecipientRestrictionFilter { City -Eq "Seattle" }

New-RoleGroup "Seattle Admins" -Roles "Mail Recipients", "Mail Recipient Creation", "Mailbox Import Export", -CustomRecipientWriteScope "Seattle Users"

This command creates a new management scope and management role group to enable members of the role group to manage recipients in Seattle.

First, the Seattle Users management scope is created, which matches only recipients who have Seattle in the City attribute on their user object.

Then, a new role group called Seattle Admins is created and the Mail Recipients, Mail Recipient Creation, and Mailbox Import Export roles are assigned. The role group is scoped so that its members can manage only users who match the Seattle Users recipient filter scope.

New-ManagementScope "Vancouver Servers" -ServerRestrictionFilter { ServerSite -Eq "Vancouver" }

$RoleGroup = Get-RoleGroup "Server Management"

New-RoleGroup "Vancouver Server Management" -Roles $RoleGroup.Roles -CustomConfigWriteScope "Vancouver Servers"

This command creates a new management scope and copies an existing role group to enable members of the new role group to manage only servers in the Vancouver Active Directory site.

First, the Vancouver Servers management scope is created, which matches only servers that are located in the Vancouver Active Directory site. The Active Directory site is stored in the ServerSite attribute on the server objects.

Then, a new role group called Vancouver Server Management is created that's a copy of the Server Management role group. This new role group, however, is scoped to allow its members to manage only servers that match the Vancouver Servers configuration filter scope.

Add-RoleGroupMember "Organization Management" -Member davids

This command adds the user davids to the Organization Management role group.

Get-ManagementRoleAssignment -Role "Mail Recipient Creation" -RoleAssignee "Seattle Admins" | Remove-ManagementRoleAssignment

This command removes the Mail Recipient Creation role from the Seattle Admins role group. This command is useful because you don't need to know the name of the management role assignment that assigns the role to the role group.

Return to top

Remote Shell

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://ExServer.contoso.com/PowerShell/ -Authentication Kerberos

Import-PSSession $Session

These commands open a new remote Shell session between a local domain-joined computer and a remote Exchange 2010 server with the FQDN ExServer.contoso.com. Use this command if you want to administer a remote Exchange 2010 server and only have the Windows Management Framework, which includes the Windows PowerShell command-line interface, installed on your local computer. This command uses your current logon credentials to authenticate against the remote Exchange 2010 server.

$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://ExServer.contoso.com/PowerShell/ -Authentication Kerberos -Credential $UserCredential

Import-PSSession $Session

These commands open a new remote Shell session between a local domain-joined computer and a remote Exchange 2010 server with the FQDN ExServer.contoso.com. Use this command if you want to administer a remote Exchange 2010 server and only have the Windows Management Framework, which includes Windows PowerShell, installed on your local computer. This command uses credentials you specify explicitly to authenticate against the remote Exchange 2010 server.

Remove-PSSession $Session

This command closes the remote Shell session between a local computer and the remote Exchange 2010 server.

Import-RecipientDataProperty -Identity "Tony Smith" -SpokenName -FileData ([Byte[]]$(Get-Content -Path "M:\AudioFiles\TonySmith.wma" -Encoding Byte -ReadCount 0))

This command shows an example of the syntax, shown in italics, required to import a file into a remote Exchange 2010 server using the FileData parameter on a cmdlet. The syntax encapsulates the data contained in the M:\AudioFiles\TonySmith.wma file and streams the data to the FileData property on the Import-RecipientDataProperty cmdlet.

The FileData parameter accepts data from a file on your local computer using this syntax on most cmdlets.

Export-RecipientDataProperty -Identity tony@contoso.com -SpokenName | ForEach { $_.FileData | Add-Content C:\tonysmith.wma -Encoding Byte}

This command shows an example of the syntax, shown in italics, required to export a file from a remote Exchange 2010 server. The syntax encapsulates the data stored in the FileData property on the object returned by the cmdlet and then streams the data to your local computer. The data is then stored in the C:\tonysmith.wma file.

Most cmdlets that output objects with a FileData property use this syntax to export data to a file on your local computer.

Return to top