Troubleshooting
Exchange Management Shell Issues
EMS Not Working - Use PowerShell Directly
Import Exchange modules manually (version-specific):
# Exchange 2007
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
# Exchange 2010
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
# Exchange 2013 & 2016
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
Remove Disabled Mailboxes
List Disabled Mailboxes in Database
Get-MailboxStatistics -Database Manager |
Where-Object {$_.DisconnectReason -eq "Disabled"} |
Format-List
Remove Disabled Mailbox by GUID
# Get mailbox GUID from previous command
Remove-StoreMailbox -Database Manager `
-Identity "d719c6ff-4e66-46f9-b297-300bea5d5951" `
-MailboxState Disabled
Remove-StoreMailbox -Database Manager `
-Identity "06e0eb65-c51d-45a0-a368-812fd79416e2" `
-MailboxState Disabled
Reference: Remove-StoreMailbox Documentation
Virtual Directory Issues
Rebuild OWA Virtual Directory
# Remove old directory
Remove-OwaVirtualDirectory "server\owa (Default Web Site)"
# Create new directory
New-OwaVirtualDirectory `
-InternalUrl "https://mail.contoso.com/owa" `
-ExternalUrl "https://mail.contoso.com/owa"
Rebuild ECP Virtual Directory
# Remove old directory
Remove-EcpVirtualDirectory -Identity "server\ecp (Default Web Site)"
# Create new directory
New-EcpVirtualDirectory `
-InternalUrl "https://mail.contoso.com/ecp" `
-ExternalUrl "https://mail.contoso.com/ecp"
Rebuild Backend Web Applications
# Remove backend applications
Remove-WebApplication -Site "Exchange Back End" -Name owa
Remove-WebApplication -Site "Exchange Back End" -Name ecp
# Recreate OWA backend
New-WebApplication -Site "Exchange Back End" -Name owa `
-PhysicalPath "C:\Program Files\Microsoft\Exchange Server\V15\ClientAccess\owa" `
-ApplicationPool MSExchangeOWAAppPool
# Recreate ECP backend
New-WebApplication -Site "Exchange Back End" -Name ecp `
-PhysicalPath "C:\Program Files\Microsoft\Exchange Server\V15\ClientAccess\ecp" `
-ApplicationPool MSExchangeECPAppPool
Configure Backend Authentication
For OWA:
Set-OwaVirtualDirectory -Identity "server\owa (Exchange Back End)" `
-WindowsAuthentication $True `
-BasicAuthentication $False `
-FormsAuthentication $False
# Restart IIS
iisreset /noforce
For ECP:
# Start PowerShell
Add-PSSnapin *exchange*
Set-EcpVirtualDirectory -Identity "server\ecp (Exchange Back End)" `
-WindowsAuthentication $True `
-FormsAuthentication $False
# Restart IIS
iisreset /noforce