Ramblings from an IT manager and long time developer.


Powershell Script to Setup Internal/External URLS for Exchange 2013

Frm here:

# Author: Scott Jaworski
# Website:
# Version: 1.0
# Description: This script sets internal and external URL's on the specified Exchange 2013 Client Access Server
# then displays the results of all the urls that have been set.
# How to Use: Copy the text file to a location on the Exchange server. Change the .txt extension to .ps1,
# Open Exchange Management Shell, Browse to the location of the script in EMS, Run .Set-Exchange2013Vdirs

Function Set-Exchange2013Vdirs
$ExServer = Read-Host "Please enter the Exchange 2013 Server Name you'd like to set Vdirs  "
$InternalName = Read-Host "Input the internal domain name eg..  "
$ExternalName = Read-Host "Input the external domain name eg.  "

Write-Host "Configuring Directories for $ExServer.." -Foregroundcolor Green

Get-WebservicesVirtualDirectory -Server $ExServer | Set-WebservicesVirtualDirectory -InternalURL https://$InternalName/EWS/Exchange.asmx -ExternalURL https://$externalName/EWS/Exchange.asmx
Get-OwaVirtualDirectory -Server $ExServer | Set-OwaVirtualDirectory -InternalURL https://$InternalName/owa -ExternalURL https://$ExternalName/owa
Get-ecpVirtualDirectory -Server $ExServer | Set-ecpVirtualDirectory -InternalURL https://$InternalName/ecp -ExternalURL https://$ExternalName/ecp
Get-ActiveSyncVirtualDirectory -Server $ExServer | Set-ActiveSyncVirtualDirectory -InternalURL https://$InternalName/Microsoft-Server-ActiveSync -ExternalURL https://$ExternalName/Microsoft-Server-ActiveSync
Get-OABVirtualDirectory -Server $ExServer | Set-OABVirtualDirectory -InternalUrl https://$InternalName/OAB -ExternalURL https://$ExternalName/OAB
Set-ClientAccessServer $ExServer -AutodiscoverServiceInternalUri https://$internalName/Autodiscover/Autodiscover.xml
Set-OutlookAnywhere -Identity "$ExServerRpc (Default Web Site)" -InternalHostname $internalName -ExternalHostName $ExternalName -InternalClientAuthenticationMethod ntlm -InternalClientsRequireSsl:$True -ExternalClientAuthenticationMethod Basic -ExternalClientsRequireSsl:$True

Write-Host "Vdirs have been set to the following.." -Foregroundcolor Green
Write-Host "$ExServer EWS"
Get-WebservicesVirtualDirectory -Server $ExServer |Fl internalURL,ExternalURL
Write-Host "$ExServer OWA"
Get-OWAVirtualDirectory -Server $ExServer | Fl internalUrl,ExternalURL
Write-Host "$ExServer ECP"
Get-ECPVirtualDirectory -Server $ExServer | Fl InternalURL,ExternalURL
Write-Host "$ExServer ActiveSync"
Get-ActiveSyncVirtualDirectory -Server $ExServer | Fl InternalURL,ExternalURL
Write-Host "$ExServer OAB"
Get-OABVirtualDirectory -Server $ExServer | Fl InternalURL,ExternalURL
Write-Host "$ExServer Internal Autodiscover URL"
Get-ClientAccessServer $ExServer | Fl AutodiscoverServiceInternalUri
Write-Host "$Exserver Outlook Anywhere Settings"
Get-OutlookAnywhere -Identity "$ExServerrpc (Default Web Site)" |fl internalhostname,internalclientauthenticationmethod,internalclientsrequiressl,externalhostname,externalclientauthenticationmethod,externalclientsrequiressl

Write-Host "The Powershell URL have not been set as part of this script. Set it if you choose" -ForegroundColor Yellow


How to Recreate the System Mailboxes in Exchange 2010

Original Source:

When you install Exchange 2010, several system mailboxes are created in the root of the Active Directory forest. The actual Active Directory accounts for these mailboxes are disabled and not intended to be used by administrators, and instead are used for things like the moderated transport system, etc.

The system mailbox descriptions and names are as follows:

  • Discovery– SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9}
  • Message Approval – SystemMailbox{1f05a927-xxxx-xxxx-xxxx-xxxxxxxxxxxx} (where x is a random number)
  • Federated E-mail – FederatedEmail.4c1f4d8b-8179-4148-93bf-00a95fa1e042

So, what happens when someone deletes these mailboxes and they are purged from Exchange? Well, the solution is simple. You just need to use the Enable-Mailbox cmdlet with the -Arbitration parameter, for example:

Enable-Mailbox "SystemMailbox{1f05a927-409a-4693-9ea1-c71cc379dab7}" –Arbitration


Run the above command for each mailbox as needed.

What if the Active Directory Accounts are Deleted?

If the system mailbox accounts are deleted from Active Directory, you can restore them by re-running the PrepareAD process using from the Exchange media: /PrepareAD


After the Active Directory accounts have been recreated, you can create mailboxes as shown in the first example using the Enable-Mailbox cmdlet. Hope this helps!

[Update] MSDN Article