Mailboxes
Get-Mailbox
Get mailboxes with an Primary email address that differs from the users alias
Get-Mailbox -ResultSize 2000 | where {$_.Alias -ne $_.PrimarySmtpAddress.Local} | select name, alias, PrimarySmtpAddress
Get-Mailbox -ResultSize 2000 | where {$_.PrimarySmtpAddress.Local -like "*2*"} | select name, alias, PrimarySmtpAddress
Get-Mailbox -Filter {(ManagedFolderMailboxPolicy -ne $null)} | select name, ManagedFolderMailboxPolicy
$Yar=Get-Mailbox -Filter {(ManagedFolderMailboxPolicy -eq $null -and RecipientTypeDetails -eq "UserMailbox")} $foo | select name, alias, RecipientTypeDetails
$LitigationHolds=Get-Mailbox -Filter {LitigationHoldEnabled -eq $True}
$LitigationHolds=Get-Mailbox -Filter {LitigationHoldEnabled -eq $True} | Get-MailboxStatistics | select DisplayName, TotalItemSize
Get-Recipient
Get-mailboxes in a specific department
The Filter property for Department only seems to work on get-recipient Filterable Properties
Get-Recipient -Filter {(Department -eq "Information Technology" -and RecipientType -eq "UserMailbox")} | select name, Database
Get-Recipient -Filter {(Department -eq "Information Technology" -and RecipientType -eq "UserMailbox")} | Get-Mailbox | select name, ManagedFolderMailboxPolicy
Room Mailbox
Move mailbox from exchange 2003 to exchange 2010
Set-Mailbox ConfRoom1 -Type Room Set-CalendarProcessing ConfRoom1 -AutomateProcessing AutoAccept -AllowRecurringMeetings $false
Conference room permissions
http://www.marcvalk.net/2010/05/exchange-2010-setting-room-permissions/
http://technet.microsoft.com/en-us/library/dd298062.aspx
Add-MailboxFolderPermission -Identity ConfRoom@blah.com:\Calendar -User JUser@blah.com -AccessRights PublishingEditor
Move Mailboxes
Finding Mailboxes to migrate by department
Get-DistributionGroupMember "Department Name" | where {$_.RecipientTypeDetails -eq "LegacyMailbox"} | select primarysmtpaddress, DatabaseName
$disabled = get-Mailbox -RecipientTypeDetails LegacyMailbox | where { $_.ExchangeUserAccountControl -match "AccountDisabled"}
$legacy =Get-Mailbox -RecipientTypeDetails LegacyMailbox $legacy | sort Database | Group-Object -Property database | select count, name $legacy | sort organizationalunit | Group-Object -Property organizationalunit | select count, name
Get-MoveRequest | Get-MoveRequestStatistics | sort status, TotalMailboxSize $moves=Get-MoveRequest | Get-MoveRequestStatistics | sort -Property lastupdatetime $moves | select DisplayName, TotalMailboxSize, alias, lastupdatetimestamp, TotalInProgressDuration
$moves | measure -Property totalmailboxsize -sum $moves | where {$_.status -eq "Queued"} | measure -Property totalmailboxsize -sum
$($moves | where {$_.status -eq "Queued"} | measure -Property totalmailboxsize -sum).sum / 1073741824 $($moves | where {$_.status -eq "Queued" -and $_.targetdatabase -eq "Mailbox Database 2"} | measure -Property totalmailboxsize -sum).sum / 1073741824
New-MoveRequest -TargetDatabase "MDB1" -BadItemLimit 50 -Identity blah@blah.com
Mailbox Statistics
$MDB=Get-MailboxStatistics -Database "Mailbox Database 1" $MDB+=Get-MailboxStatistics -Database "Mailbox Database 2" $MDB | where {$_.TotalItemSize.Value.ToMB() -gt 2048 } | sort TotalItemSize | select DisplayName, TotalItemSize
$MDB1=Get-MailboxStatistics -Database "Mailbox Database 1" | sort TotalItemSize $MDB1 | select DisplayName, @{Name="PrimarySmtpAddress";Expression={((Get-Mailbox -Identity $_.identity.MailboxGuid.Guid).PrimarySmtpAddress.tostring())}}, @{Name="TotalItemSize";Expression={($_.TotalItemSize.value.tokb())}}
Export Mailbox
http://technet.microsoft.com/en-us/library/ee633455.aspx
http://technet.microsoft.com/en-us/library/ff607299.aspx
$date = (Get-Date).adddays(-60) New-MailboxExportRequest -Mailbox kcurran -ContentFilter {(Received -gt $date) -or (Sent -gt $date)} -FilePath "\\exchange1\TemporaryPSTs\kcurran60days.pst"
When running the command above it does not seem to filter properly
Get-MailboxExportRequest | Get-MailboxExportRequestStatistics | fl ContentFilter ContentFilter : ((Received -ne $null) -or (Sent -ne $null))
New-MailboxExportRequest -Mailbox kcurran -ContentFilter {(Received -gt "7/29/2011") -or (Sent -gt "7/29/2011")} -FilePath "\\exchange1\TemporaryPSTs\kcurran60days.pst"
Notes / links
http://technet.microsoft.com/en-us/library/dd638187.aspx
http://technet.microsoft.com/en-us/library/bb201749.aspx
http://msexchangeteam.com/archive/2009/02/26/450776.aspx
Manual export to PST due to bug trying to move mailboxes to Exchange 2010 SP1 Spent 2 months trying to work with MS on issue
When you export to pst calendar items get a "Copy: " prefix this link has vba code to remove it.