Easy and Useful PoweShell Commands used for Exchange Server 2010

Have you ever wondered how to make your life as a Network or Exchange Administrator a lot easier by using the PowerShell commands in your Exchange Server 2010? Some tasks can be daunting so I have compiled some easy to follow commands. I have actually been using all of these.

Note:  Mailbox Database, User, domain.com, usermail.com are just examples that I used and all fictitious, you may replace them with appropriate database name, domain, User and email.

Some common tasks that the Exchange Server 2010 System Manager was used for was exporting lists of mailbox users into CSV format for reporting in Excel, knowing the Statistics of Users Mailboxes and Whitelisting.

Export output of Mailbox Users in CSV format, and then open it up in Excel.

Get-MailboxDatabase “Mailbox Database” | Get-MailboxStatistics | Sort totalitemsize -desc | Export-CSV C:\mailboxes.csv

Statistics of all Users mailboxes in a particular database.

Get-MailboxDatabase “Mailbox Database” | Get-MailboxStatistics | Sort totalitemsize -desc | ft displayname, totalitemsize, itemcount

Statistics of a particular User

Get-MailboxStatistics User | ft DisplayName, TotalItemSize, ItemCount

Whitelisting Domain

Set-ContentFilterConfig -BypassedSenderDomains the domain.com

Whitelisting a Specific Email

Set-ContentFilterConfig -BypassedSenderDomains the useremail.com

Using SMTP Relay in Exchange Server 2007 and 2010

What is Simple Mail Transfer Protocol (SMTP) Relay?  SMTP Relay will bypass your ISP’s email outbound restrictions.

Scenario:  You are running Exchange Server 2010, everything seems to be going well – and then one day all employees within company.com domain cannot send out any emails.  You have checked the Event Viewer and can’t find any relevant critical errors in Event IDs pertaining to the issue. You have verified that SMTP Ports are opened up in your Security or Firewall Device, so what could it be?

This has been a common issue if your company is hosting Exchange Server, there are times that for any reasons your ISP could be blocking SMTP Ports. The workaround is to find a reliable SMTP Relay Provider, make sure that the Provider has a redundancy backup just in case the primary SMTP Relay server goes down.  Based on my actual experience dealing with this type of setup, it really works and they are very reasonable too. Rest assured that your email will go out 24/7.

Verify if your ISP is blocking the outgoing SMTP port by running these DOS command:

c:\> telnet relayprovider.com 25

You may also try Port 26, 940, 8001, 2525, 80 by using the same telnet command  instead of  Port 25. If the connection gets responses from the alternative SMTP port, you should use that port instead of Port 25 when setting up Smart Hosting.

How to configure the SMTP Relay?

Open up Exchange Management Console (EMC)>Organization Configuration>Hub Transport>New Send Connector

You may follow the guide from your SMTP Relay Provider’s website to complete the process of setting up SMTP Relay.