Useful Exchange Powershell 2007\2010


(Active Work in progress)

2010=Orange
2007=Green
Both=Black

Mail Box

    Function Commandlet
    Check DAG replication status get-mailboxdatabasecopystatus
    Check CCR replication status get-storagegroupcopystatus
    Test Cluster Replication health test-replicationhealth
    Clean Mail Box Database Get-MailboxDatabase | Clean-MailboxDatabase
    CSV Report for mail statistics ordered Greatest to least. Get-MailboxStatistics | sort-object totalitemsize -Descending  | select-object displayname, itemcount, totalitemsize | Export-Csv -path c:\mboxStats.csv
    Reseed all Storage groups

    Get-StorageGroup -Server RR-MB-CLUS | suspend-StorageGroupCopy

    Get-StorageGroup -Server RR-MB-CLUS | Update-StorageGroupCopy -DeleteExistingFiles

    Reseed all failed 2010 Mailbox databases (from passive node) Get-MailboxDatabaseCopyStatus | where {$_.Status -like "Failed"} | suspend-MailboxDatabaseCopy

    Get-MailboxDatabaseCopyStatus | where {$_.Status -like "suspended "} | Update-MailboxDatabaseCopy –DeleteExistingFiles

    Reseed all failed 2007 Storage Groups Get-StoragegroupCopyStatus | where {$_.summarycopystatus -like "Failed"} | suspend-StoragegroupCopy

    Get-StoragegroupCopyStatus | where {$_.summarycopystatus -like "suspended"} | Update-StoragegroupCopy –DeleteExistingFiles

    Remove all Move requests get-moverequest | remove-moverequest

Client Access

    Function Commandlet
      Test-ActiveSyncConnectivity
      Test-OutlookWebServices
      Test-OwaConnectivity
      Test-WebServicesConnectivity
       
       

Transport\Edge

    Function Commandlet
      Test-EdgeSynchronization
      Test-Mailflow
       
       

 

Other

    Function Commandlet
      Test-ServiceHealth
      Test-SystemHealth
    Cert Request for public CA New-ExchangeCertificate -GenerateRequest -SubjectName "C=US, O=Company, CN=mail.domain.com" -domainname mail.domain.com,autodiscover.domain.com,hostname,hostname.domain.local -FriendlyName mail.domain.com -privatekeyexportable:$true -path c:\cert_myserver.txt
    Import public cert

    Import-ExchangeCertificate –Path “C:\CertificateFile.cer” | Enable-ExchangeCertificate -Services pop, smtp, iis, imap

    use this then on any command you run that requires –credential the value is $cred $cred = get-credential
       

     

5 thoughts on “Useful Exchange Powershell 2007\2010

  1. Thank you for this great go-to list of handy commands! I’m using the “Reseed all failed 2007 Storage Groups” command right now, because last time I had this issue I stayed up through the night doing one reseed after another, and this time around I figured I could just run one command to handle it – and google led me to you. Thanks to you I will get some sleep tonight!

  2. Jedi,

    Suppose I run the following script:

    Get-StoragegroupCopyStatus | where {$_.summarycopystatus -like “Failed”} | suspend-StoragegroupCopy
    Get-StoragegroupCopyStatus | where {$_.summarycopystatus -like “suspended”} | Update-StoragegroupCopy –DeleteExistingFiles

    in the following scenario, what could happened:

    1. running it on the Active cluster rather than on passive accidentally ?
    2. the Online Exchange VSS backup is currently running Full ?

    and thanks for sharing.

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