TechShizz | All posts tagged 'Exchange 2013'

Disable Autodiscover for Office 365 Migration

When migrating to Office 365 the internal outlook users are not able to use autodiscover.

This is because the internal exchange server also uses autodiscover in IIS.

Use this description to remove the internal AutodiscoverVirtualDirectory

Be sure that this is the proper migration plan for you’re organization!

1. Open an elevated command prompt and back-up the IIS configuration (Just in case !):

cd %windir%system32inetsrvappcmd.exe add backup “Before Removing Autodiscover”

2. Open an elevated Exchange Management Shell and retrieve the current autodiscover virtual directory:

Get-AutodiscoverVirtualDirectory | fl Name, Server, InternalUrl, Identity

Copy the Identity value to the clipboard.

3. In the Exchange Management Shell, remove the autodiscover virtual directory:

Remove-AutodiscoverVirtualDirectory -Identity “ALPHAAutodiscover (Default Web Site)”

When you’re identity contains a space, use the quotation marks ”

You will have to confirm by typing a “Y”.

4. Check that the autodiscover virtual directory is gone:

Get-AutodiscoverVirtualDirectory | fl Name, Server, InternalUrl, Identity

This should now return nothing.

5. Now, with Outlook running on a desktop, hold the Ctrl button, right-click on the Outlook icon in the system tray, and select Test E-mail AutoConfiguration. Enter your email address and password and click the Test button. The results should come from the Office 365 server.

How to purge deleted items from recoverable items in Exchange

If you want to delete all the deleted items in a mailbox that are still recoverable you can use this command:

Search-Mailbox -Identity "David Cooper" -SearchDumpsterOnly -TargetMailbox "Discovery Search Mailbox" -TargetFolder "david.cooper-RecoverableItems" -DeleteContent

If you do not wish to make a copy of the deleted items first to the Discovery Mailbox, and just delete them, use this command:

Search-Mailbox -Identity "David Cooper" -SearchDumpsterOnly -DeleteContent

List all SMTP addresses with PowerShell

Open PowerShell > 


Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,ServerName,PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}}

Office 365: Security, Distribution and Dynamic Distribution groups - (Power Shell)

Create and view a mail-enabled security group

New-DistributionGroup -Name "GroupA" -alias groupa -Type security

Get-DistributionGroup GroupA | FL Name,RecipientTypeDetails,PrimarySmtpAddress


Create a mail-enabled distributiongroup

New-DistributionGroup -Name "GroupB" -Alias groupb -MemberJoinRestriction open

Create and view a dynamic distributiongroup

New-DynamicDistributionGroup -IncludeRecipients MailboxUsers -Name "Marketing Dynamic Group" -Department Marketing

How do we know this worked?

Get-DynamicdistributionGroup -Identity "Marketing" | Format-List