Friday, September 23, 2011

Common Exchange 2007/2010/2013 commandlets - Documenting for reference

Since now and then I need to go back and check the exchange commandlets help I thought of creating a list that I could refer to whenever I like:

NOTE: To Export to text file use OUT-FILE instead with pipe (|)
 

WhiteSpace on all Exchange 2010 DB’s
get-mailboxdatabase -status | fl Server,name,AvailableNewMailboxSpace

Mailbox Folder statistics
Get-MailboxFolderStatistics -Identity TESTUSER1

Mailbox statistics per DB for all mailboxes
Get-MailboxStatistics -database "Mailbox Database"
| fl Displayname,ItemCount,TotalItemSize,totalDeletedItemSize

DisplayName, ItemCount and size in MB per database
Get-MailboxStatistics -Database "Mailbox Database"
| Format-Table DisplayName, ItemCount, @{expression={$_.totalitemsize.value.ToMB()};label="Size(MB)"}

Create Bulk Folders in Users Mailboxes
New-MailboxFolder -Name <String> -Parent <MailboxFolderIdParameter> [-Confirm [<SwitchParameter>]] [-DomainController <Fqdn>] [-WhatIf [<SwitchParameter>]]
Just need to put it in the loop how we do it for bulk user mailboxes.
NOTE: New-MailboxFolder cmdlet is only added to Exchange 2010 SP1 so watch for that. Last time tested with SP2.

List all the permissions applied to a mailbox
get-mailboxpermission -identity TestMailbox |format-list

List all the permissions a particular user has over a specific mailbox
Get-Mailbox "TestMailbox" | Get-MailboxPermission -user "Es1_Service"  | format-list

Add Save-As extended rights over a mailbox database
Add-AdPermission -identity "mailbox database" -user "ServiceAccount" -ExtendedRights Send-As

Add Save-As rights over the whole server
Add-ADPermission -identity (get-mailboxserver -identity "mailboxServerName" | select-object).DistinguishedName -user "Domain\ServiceAccount" -ExtendedRights Send-As


Display disabled mailboxes (tested on exchange 2007)
Get-MailboxStatistics -Server "ServerName" | where{$_.DisconnectDate -ne $Null}

Check if any mailboxes reached quota. This will check all environment wise (Exchange 2010):
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Format-List DisplayName,ServerName,StorageLimitStatus,TotalItemSize,TotalDeletedItemSize,ItemCount,DeletedItemCount

List Exchange ServerName, Edition and Build number 
Get-ExchangeServer | FL Name, Edition, AdminDisplayVersion
(Note: AdminDisplayVersion in some roleup is not updated properly, you may find EMC showing different version than what commandlet will print. Usually I find EMC displaying correct info (last time found Exchange 2010 SP2 RU4 V1 displayed in commandlet as Version 14.2 (Build 247.5) )

Verify that extended permissions are applied to the MailboxDatabase

Get-Mailboxdatabase -server ExchangeServer| Get-ADPermission | where-object { ($_.extendedrights -like "*receive*" -or $_.extendedrights -like "*ms-Exch-Store-Visible*" -or $_.extendedrights -like "*ms-Exch-Store-ad*") -and ($_.User -like "*S1_Service*") } | select Identity, User, ExtendedRights, IsInherited | ft –wrap


1 comment:

go-budi-blog said...

thanks
very interesting article