Bulk Import from GMail (or any IMAP server) to Exchange

This command appears to have been removed in 2013, but it’s one that is worth documenting anyway since it may be worth spinning up a 2007-2010 server to use it if you find yourself needing to migrate off that mistake someone previously made by moving everyone to Google apps, and back to Exchange.

CSV Columns:
SourceIdentity,Sourceserver,SourceLoginID,SourcePassword,uName

Read more

Bulk script creation of users with custom passwords

This exchange script will import a CSV file with the following column names and create the user accounts, including a unique password for each user as defined by the CSV file.  Great for new environments where you have a list of users and their existing passwords.

CSV Columns:
uName, FirstName, LastName, UPN, Password

Read more

Bulk Rewrite of Display Name

A customer wanted to identify their employees by department when they were emailing people to ensure that people knew who they were dealing with, ex Sales, Finance, Legal Etc.

This script will import a CSV file with a list of existing usernames and prepend the title “Sales-” to their display name. Read more

Outlook 2013 Import NK2 file

This one isn’t PowerShell related, but it’s a common enough issue relating to Exchange that I wanted to post it anyway.

There are many posts showing up in a Google search that incorrectly report the path that Outlook looks at to import the NK2 file from.  The correct path is:

c:\Users\%username%\AppData\Roaming\Microsoft\Outlook\%profilename%.nk2

Once you move the NK2 file from the old machine to the new machine, from the run window (start -> run or Windows key + R) type in “outlook.exe /importnk2″ without the quotes and it will import the file and rename it to .old

List all Disconnected Mailboxes with timestamp

I came across a situation where someone was messing around in AD and had accidentally deleted an account, Realizing their mistake they re-created with the same password it thinking it would just re-connect to the mailbox and the user would be fine.  By the time they called me they had deleted and re-created the account a number of times.  I had to identify the correct mailbox to reconnect to the user account, out of 4-5 versions all with the same exact name.

This command shows all disconnected mailboxes as well as the date the corresponding user account was deleted, and leaving the mailbox disconnected. The timestamp allowed me to connect the correct mailbox to the account without having to guess at anything.

get-mailboxserver | get-mailboxstatistics | where { $_.DisconnectDate } | fl DisplayName, DisconnectDate

Enable Exchange 2013 Spam Filtering

MX Logic or Postini:

If you use MX Logic, Postini, or a similar spam filtering service, you want to make sure you white list the IP ranges the service uses to submit email to your server.

Set-TransportConfig -InternalSMTPServers @{Add="208.65.144.0/21","208.81.64.0/21"}

These IP ranges are for MX Logic.

Enable RBL Checking and Sender ID Config:

If you are not using a 3rd party filtering service it is a good idea to enable RBL checking, and delete spoofed email as determined by SenderID.

Add-IPBlockListProvider -name bl.spamcop.net -lookupdomain bl.spamcop.net
Add-IPBlockListProvider -name zen.spamhaus.org -lookupdomain zen.spamhaus.org
Set-SenderIDConfig -SpoofedDomainAction Delete

Exchange 2013 Messsage Tracking “Console”

Exchange 2013 lacks the traditional Exchange Management Console that you are probably familiar with, and with it went the message tracking console that many administrators relied on to troubleshoot mail flow problems.  Sure there is now the Delivery Reports tool in the web Exchange Control Panel, but it’s just not quite the same, especially since it limits you to searching within a specific mailbox.

ECP Mail Flow

Luckily there is something similar to the Message Tracking Center in Powershell. Read more