Exchange 2010 Scripts

Check Queue

Get-transportserver | ? {-NOT $_.NameContains("EDGE")} | get-queue >queuereport.txt

Get-transportserver | ? {-NOT $_.NameContains("EDGE")} | get-queue | ? {$_.DeliveryType -ne 'ShadowRedundancy'} >queuereport.txt

(If you need to check the queue in just a specific region, where the (transport) server identity of each region starts with the initials of each country ie: server names are HKexch1, HKexch2, HKExch3)
eg:
get-transportserver HK* | get-queue 
get-transportserver SNG* | get-queue 
get-transportserver LDN* | get-queue
get-transportserver Switz* | get-queue  
get-transportserver Dubai* | get-queue  

Finding which CAS you are connected to:
Get-LogonStatistics -Server Mailboxservername |ft username, clientname, clientversion

Get-LogonStatistics -Identity jsmith | Sort-Object "LastAccessTime" |  ft  username, clientname, *last*

Get-LogonStatistics -Server Mailboxservername |ft username, clientname


Set a manager for all DL's beginning with HR


Get-distributionGroup -resultsize unlimited| where {$_.name -like "HR_*" -or $_.name -like "ib*"}|set-distributiongroup -ManagedBy user@domain.com, user2@domain, user3@domain.com, user4@domain.com


Get-DistributionGroup project* | set-distributiongroup -ManagedBy user@domain.com, user2@domain.com, user3@domain.com

Resubmitting a message queue for processing

get-queue | ? {$_.messagecount -gt 1} | retry-queue -resubmit:$true

get-queue | ? {$_.DeliveryType -ne 'ShadowRedundancy' -AND $_.Status -eq 'Retry'} | retry-queue -resubmit:$true

How to view all accounts in the forest
Set-AdServerSettings -ViewEntireForest $true

Content index State
Get-MailboxDatabaseCopyStatus -Server <servername>  | ?{$_.contentindexstate -eq “failed"}
Get-MailboxDatabaseCopyStatus –Server <servername>  | ? {$_.contentindexstate -eq “failed"} | update-mailboxdatabasecopy –catalogonly  













No comments:

Post a Comment