Mostly used Power shell commands in Exchange 2010


1. To create a new mail database
#New-MailboxDatabase –StorageGroup “SERVER2\First Storage Group” –name “Mailbox Store2”

2. To mount the database,
#Mount-database “SERVER2\First Storage Group\Mailbox Store2”

3. To test the connectivity of the recipient mailbox and also to check the latency.
#Test-MapiConnectivity raji@company.com

4. To get the list of mailbox with the maximum mailbox size,
#Get-wmiobject -class Exchange_Mailbox -Namespace ROOT\MicrosoftExchangev2 -ComputerName SERVER1 | select-object MailboxDisplayName,TotalItems,Size | sort -descending “Size” | select-object -first 25

5. To view in the HTML format.
#Get-wmiobject -class Exchange_Mailbox -Namespace ROOT\MicrosoftExchangev2 -ComputerName SERVER1 | select-object MailboxDisplayName,TotalItems,Size | sort -descending “Size” | select-object -first 25 | ConvertTo-html -title “Top 25 Largest Mailboxes on SERVER1” > “D:\Stats\25 Largest Mailboxes.html”

6. To get the events in the application log
#Get-eventlog Application | where {$_.Source -ilike “Exchange*”} | export-csv c:\events.csv

7. To get the information of particular user mailbox
# Get-Mailbox –Identity “Raji”
#Get-Mailbox “Raji”
#Get-Mailbox raji@test.com

8. To get the list of exchange servers in the organization,
#Get-ExchangeServer
#Get-ExchangeServer -Domain microsoft.com
#Get-ExchangeServer –Status

9. To get the mailbox database details,
# Get-MailboxDatabase -Server Server
#Get-MailboxDatabase -StorageGroup StorageGroup

10. To set the quota limit parameter for particular database,
# Set-MailboxDatabase -Identity MailboxDatabase -IssueWarningQuota 500MB

11. To set the user’s mailbox properties like external Email Email address value,
# Set-MailUser -Identity raji2 -ExternalEmailAddress raji@external.com

12. To get all the records which matching the namespace “Raji”, it check in all the possible recipients like user mailbox, contacts, etc.
# Get-Recipient -Anr “Raji”

13. To Enable/Disable the user,
# Disable-MailUser -Identity user2
# Enable-Mailbox -Identity company\user1 -Database MailboxDatabase

14. To get the mailbox statistics of the database,
# Get-MailboxStatistics -Database MailboxDatabase
#Get-MailboxStatistics -Server Server

15. To give full access permission for the user1 on the mailbox user2,
#Add-MailboxPermission user2 -User user1 -AccessRights FullAccess
#Add-MailboxPermission user2 -user CODE1\user1 -AccessRights:FullAccess,ExternalAccount

 16. To move all mailboxes

#Get-Mailbox –server server1 | Move-Mailbox –targetdatabase “server2\Mailbox Store1”
#Get-Mailbox | where-object { $_.name –like “raji*” } | Move-Mailbox –targetdatabase “Server2\Mailbox Store1” –Confirm

Advertisements

About Raji Subramanian

Nothing great to say about me...Just want to share my knowledge for others that will be useful at any moment of time when they stuck in critical issue....
This entry was posted in Commands. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s