Exchange 2010/2013 Helpful scripts

This sets your inside/outside and auto-discover URLs to the same address so you can buy a single domain SSL for your exchange server.

$FQDN = Read-Host -Prompt 'mail.example.com'
Get-webservicesVirtualDirectory | Set-webservicesVirtualDirectory –ExternalUrl https://$FQDN/Ews/Exchange.asmx –InternalUrl https://$FQDN/Ews/Exchange.asmx
Get-OabVirtualDirectory | Set-OabVirtualDirectory –ExternalUrl https://$FQDN/Oab –InternalUrl https://$FQDN/Oab
Get-EcpVirtualDirectory | Set-EcpVirtualDirectory –ExternalUrl https://$FQDN/Ecp –InternalUrl https://$FQDN/Ecp
Get-OwaVirtualDirectory | Set-OwaVirtualDirectory –ExternalUrl https://$FQDN/Owa –InternalUrl https://$FQDN/Owa
Get-ActiveSyncVirtualDirectory | Set-ActiveSyncVirtualDirectory -ExternalUrl https://$FQDN/Microsoft-Server-ActiveSync -InternalUrl https://$FQDN/Microsoft-Server-ActiveSync
Get-ClientAccessServer | Set-ClientAccessServer –AutodiscoverServiceInternalUri https://$FQDN/Autodiscover/Autodiscover.xml

IIS Redirection for easy OWA access (for dedicated exchange CAS)

$FQDN = Read-Host -Prompt 'mail.example.com'
cp C:\inetpub\wwwroot\iisstart.htm C:\inetpub\wwwroot\iisstart.htm.bak
cp C:\inetpub\custerr\en-US\403.htm C:\inetpub\custerr\en-US\403.htm.bak
cat C:\inetpub\wwwroot\iisstart.htm.bak | % { $_ -replace "","" } | Set-Content C:\inetpub\wwwroot\iisstart.htm
cat C:\inetpub\custerr\en-US\403.htm.bak | % { $_ -replace "","" } | Set-Content C:\inetpub\custerr\en-US\403.htm

BCC Violation Check

Get-ExchangeServer | Get-MessageTrackingLog -eventid RECEIVE -Start (Get-Date).AddDays(-30) -Resultsize unlimited | Format-Table -Wrap -Property sender,recipients,recipientstatus | where  {$_.recipientstatus -like "Bcc"}

Sender Callout Fix for 2013

$ReceiveConnector = "Default Frontend $env:computername"
Set-ReceiveConnector -TransportRole HubTransport -Identity $ReceiveConnector

cd "C:\Program Files\Microsoft\Exchange Server\V*\Scripts\"
./install-AntispamAgents.ps1
Set-ContentFilterConfig -Enabled $False
Set-IPAllowListConfig -Enabled $False
Set-IPAllowListProvidersConfig -Enabled $False
Set-IPBlockListConfig -Enabled $False
Set-IPBlockListProvidersConfig -Enabled $False
Set-SenderFilterConfig -Enabled $False
Set-SenderIdConfig -Enabled $False
Set-SenderReputationConfig -Enabled $False
Set-RecipientFilterConfig -RecipientValidationEnabled $true -Enabled $True
Restart-Service MSExchangeTransport

Say Something Nice