TechShizz | All posts tagged 'Exchange 2010'

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}}}

Working with Mail Contacts (PowerShell)

Create contacts with a CSV files

Import-CSV "C:\Contacts.csv | %{New-MailContact -Name $_.Name -DisplayName %_.Name -ExternalEmailAddress $_.ExternalEmailAddress -FirstName $_.FirstName -LastName $_.LastName}
Add more information to each existing contact using a CSV file

$Contacts = Import-CSV "C:\UpdateContacts.csv"

$Contacts | ForEach {Set-Contact $_.Name -StreetAddress $_.StreetAddress -City $_.City -StateorProvince $_.Stateorprovince -PostalCode $_.Postalcode -Phone $_.phone -MobilePhone $_.Mobilephone -Pager $_.Pager -HomePhone $_.HomePhone -Company $_.Company -Title $_.title}


Hide Contacts Using Power Shell
Set-MailContact -HiddenFromAddressListsEnabled $true

OR to set ALL contacts as hidden from GAL
Get-Contact -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'MailContact')} | Set-MailContact -HiddenFromAddressListsEnabled $True

Enforce IP restriction in Exchange Receive connector to prevent SPAM circumnavigating Anti-SPAM.

For AVG Anti-SPAM

Enforcing IP restrictions is absolutely critical to complete protection of your mail server. Because hackers and spammers can easily bypass cloud services and target your server directly, mail servers protected by AVG AntiSpam should accept only accept SMTP connections from AVG AntiSpam IP's listed below and deny all other traffic:  

100.42.120.96/27 (100.42.120.96/255.255.255.224)
100.42.115.0/27 (100.42.115.0/255.255.255.224)
208.70.208.0/22

1. From the EAC, click mail flow.
2. On the Mail Flow menu, click “Receive Connectors”, then select Default Hub Transport, and finally click the edit icon.