List/remove/add Exchange Virtual Directory from Powershell

(more info coming soon, sorry, XXXXXXX is a web site name)

Open Exchange Management Shell with elevated permission

Get-AutodiscoverVirtualDirectory
Get-OABVirtualDirectory
Get-OWAVirtualDirectory
Get-WebServicesVirtualDirectory
Get-ActiveSyncVirtualDirectory
Get-UMVirtualDirectory

Remove-OWAVirtualDirectory -Identity "Owa (XXXXXXX)" -Confirm:$false
Remove-OWAVirtualDirectory -Identity "Exadmin (XXXXXXX)" -Confirm:$false
Remove-OWAVirtualDirectory -Identity "Exchange (XXXXXXX)" -Confirm:$false
Remove-OWAVirtualDirectory -Identity "Exchweb (XXXXXXX)" -Confirm:$false
Remove-OWAVirtualDirectory -Identity "Public (XXXXXXX)" -Confirm:$false
Remove-WebServicesVirtualDirectory -Identity "EWS (XXXXXXX)" -Confirm:$false
Remove-ActiveSyncVirtualDirectory -Identity "Microsoft-Server-ActiveSync (XXXXXXX)" -Confirm:$false
Remove-OabVirtualDirectory -Identity "OAB (XXXXXXX)" -Force:$true -Confirm:$false
Remove-UMVirtualDirectory -Identity "UnifiedMessaging (XXXXXXX)" -Confirm:$false
Remove-AutodiscoverVirtualDirectory -Identity "Autodiscover (XXXXXXX)" -Confirm:$false

New-OWAVirtualDirectory -WebsiteName "XXXXXXX" -OwaVersion "Exchange2007" ExternalAuthenticationMethods Fba
Set-OWAVirtualDirectory -InternalUrl "https://INTERNAL_FQDN_OF_EXCHANGE/owa/" ClientAuthCleanupLevel "Low" -LogonFormat "UserName" DefaultDomain “NETBIOSDOMAINNAME” Identity "Owa (XXXXXXX)"
New-OWAVirtualDirectory -WebsiteName "XXXXXXX" -OwaVersion "Exchange2003or2000" VirtualDirectoryType "Exadmin" ExternalAuthenticationMethods Fba
New-OWAVirtualDirectory -WebsiteName "XXXXXXX" -OwaVersion "Exchange2003or2000" VirtualDirectoryType "Mailboxes" ExternalAuthenticationMethods Fba
New-OWAVirtualDirectory -WebsiteName "XXXXXXX" -OwaVersion "Exchange2003or2000" VirtualDirectoryType "Exchweb" ExternalAuthenticationMethods Fba
New-OWAVirtualDirectory -WebsiteName "XXXXXXX" -OwaVersion "Exchange2003or2000" VirtualDirectoryType "PublicFolders" ExternalAuthenticationMethods Fba
New-WebServicesVirtualDirectory -WebsiteName "XXXXXXX" InternalUrl "https://INTERNAL_FQDN_OF_EXCHANGE/EWS/Exchange.asmx" -basicauthentication 1 windowsauthentication 1
New-ActiveSyncVirtualDirectory -WebsiteName "XXXXXXX" InternalUrl "https://INTERNAL_FQDN_OF_EXCHANGE/Microsoft-Server-ActiveSync" ExternalAuthenticationMethods Basic -InternalAuthenticationMethods Basic
New-OabVirtualDirectory -WebsiteName "XXXXXXX" -InternalUrl "https://INTERNAL_FQDN_OF_EXCHANGE/OAB"
Set-OabVirtualDirectory -PollInterval "30" -Identity "oab (XXXXXXX)"
New-UMVirtualDirectory -WebsiteName "XXXXXXX" InternalUrl "https://INTERNAL_FQDN_OF_EXCHANGE/UnifiedMessaging/Service.asmx"
New-AutodiscoverVirtualDirectory -WebsiteName "XXXXXXX" InternalUrl "https://INTERNAL_FQDN_OF_EXCHANGE/Autodiscover/Autodiscover.xml" BasicAuthentication 1 -WindowsAuthentication 1
Set-ClientAccessServer -Identity “Servername” AutoDiscoverServiceInternalUri "https://INTERNAL_FQDN_OF_EXCHANGE/Autodiscover /Autodiscover.xml"
Set-OfflineAddressBook "Default Offline Address Book" VirtualDirectories "Servername\OAB (XXXXXXX)" -Versions Version2,Version3,Version4)"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s