Wednesday, 25 July 2012

Exchange Server Cmdlets

1. quick shortcut to get all the commands

Get-Command | Format-List Definition

2. How to move mailbox

Get-Mailbox -Server SRV1 | Move-Mailbox -TargetDatabase SRV2

3. To get a list of all users on an Exchange server who are not Unified Messaging-enabled type, 

Get-UmMailbox | ForEach { If($_.UmEnabled -Eq $False){$_.Name}} 

4. To display the user’s alias formatted in a table together with the user’s Exchange server name and telephone extension, type:


Get-UmMailbox | Format-Table ServerName,@{e={$_.SamAccountName};Label=”User Alias”},@{Expression=”Extensions”;Label=”Telephone numbers


5. If you want to test all IP Block List providers, you just have to pipe the Get-IpBlockListProvider cmdlet to the Test-IpBlockListProvider


Get-IpBlockListProvider | Test-IpBlockListProvider -IpAddress 192.168.0.

6. Before you remove an object by using the Remove verb, use the WhatIf parameter to verify the results are what you expect.

7. Get all Win32 WMI information, such as perfmon counters and local computer configurations. For example,

Get-WMIObject Win32_PerfRawData_PerfOS_Memory 

8. You can configure real-time block list (RBL) providers with the Exchange Management Shell by running the following two commands:


Set-IPBlockListProvidersConfig -Enabled $True -ExternalMailEnabled $True
And then

Add-IPBlockListProvider -Name -LookupDomain -AnyMatch $True 

9. Access the event log from the Exchange Management Shell. To retrieve the whole event log,

Get-EventLog Application | Format-List

To retrieve all Exchange-related events

Get-EventLog Application | Where { $_.Source -Ilike “*Exchange*” } 

10. you can use wildcard characters to retrieve all properties that matches the part of the name that you specify:

Get-Mailbox | Format-Table Name,*SMTP* 

11. 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:

Get-Mailbox *John* | Set-Mailbox -ProhibitSendQuota 100MB

This command matches all mailboxes with the name “John” in the mailbox’s identity and set the ProhibitSendQuota parameter to 100MB. 

Get-MailboxDatabase “Normal” | Get-Mailbox | Set-Mailbox -ProhibitSendQuota 100MB

This command retrieves all the mailboxes that reside in the “Normal” mailbox database and sets their ProhibitSendQuota value to 301MB

12. 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: Get-Mailbox | Test-MapiConnectivity

Mailbox databases: Get-MailboxDatabase | Test-MapiConnectivity

Servers: Get-MailboxServer | Test-MapiConnectivity 

13. 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:

Start-Transcript c:\MySession.txt -Append 

14. How to check the Exchage server version, server role, site?

Get-ExchangeServer | fl name, edition, serverrole, site