Monday, December 16, 2013

Microsoft Exchange server Common Scripts from Exchange Management Shell

How to find Mailbox is Shared Mailbox

C:\Get-mailbox -Resultsize unlimited | Where-object {$_.Isshared -eq $True}



An alternative way to identify possible problematic receive connectors by using Exchange Management Shell, is if the queue delivery type is SmtpRelayToRemoteAdSite. To do this, run the following shell commands:
$remotesite = (get-queue | where {$_.LastError -like "451 4.4.0*"}).NextHopDomain

get-exchangeserver | where {$_.site -like '*'+$remotesite} | get-transportserver | Get-ReceiveConnector | where {$_.Bindings -like '*:25*'} | where {$_.AuthMechanism -notlike '*Exchange*'

From blog 
http://blogs.technet.com/b/rmilne/archive/2014/02/23/exchange-2010-tip-of-the-day-26-to-50.aspx

This command spins through all your mailbox servers and reconnects all the uniquely identified but disconnected mailboxes in any one of the mailbox stores:
$Servers = Get-ExchangeServer 

$Servers | ` 
Where { $_.IsMailboxServer -Eq '$True' } ` | ForEach { Get-MailboxStatistics -Server $_.Name ` 
  | Where { $_.DisconnectDate -NotLike '' } ` | ForEach { Connect-Mailbox -Identity `$_.DisplayName -Database $_.DatabaseName} }


Want to know what version of Exchange Server each of your servers is running? Type:
Get-ExchangeServer | Format-Table Name, *Version*


Want to create a group of test users in your lab? Use this command:
1..100 | ForEach { Net User "User$_" MyPassword=01 /ADD /Domain; Enable-Mailbox "User$_" }


No comments:

Post a Comment