Sunday, July 8, 2012

Suspend Multiple Database Copies

If you are doing maintenance on a server and want to suspend all passive database copies on that server it is very simple and all you have to do is run:
Get-MailboxDatabaseCopyStatus -Server "server_name" | Suspend-MailboxDatabaseCopy -Confirm:$False

Because we are not excluding the current mounted DBs (if any), the script will throw an error stating that “The suspend operation can't proceed because database "db_name" on Exchange Mailbox server "server_name" is the active mailbox database copy” - which is fine because it’s what we want.

If you want to suspend all passive copies of a particular database across all servers you can simply run:
Get-MailboxDatabaseCopyStatus "db_name" | Suspend-MailboxDatabaseCopy -Confirm:$False

But what if you are reducing the number of database copies in your environment and just want to suspend the 4th copy of all your DBs across all your servers? In this case, we will have to use the following script:
$dbs = Get-MailboxDatabase

ForEach ($db in $dbs) {
  ForEach ($dbCopy in $db.DatabaseCopies) {
    If ($dbCopy.ActivationPreference -eq 4) {
      Suspend-MailboxDatabaseCopy $dbCopy.Identity -Confirm:$False
    }
  }
}

Hope this helps!

Wednesday, July 4, 2012

Troubleshooting Outlook Calendar Problems

If your users are experiencing issues with their Outlook Calendar, Microsoft released back in May a tool to help administrators in these situations, the Calendar Checking Tool for Outlook (also known as CalCheck).

This is a command-line tool that opens an Outlook profile on the local machine, opens the Outlook Calendar and checks permissions, free/busy information and auto booking, for example. The tool then checks each item in the calendar for any problems.

The calendar to by analyzed must reside on an Exchange Server and this tool does not work with IMAP, POP3 or any other non-Exchange mail servers.

To download it go to this link.

Monday, July 2, 2012

Microsoft MVP Award 2012


Yesterday, July 1st 2012 was a happy day for many people out there and I was one of them. I was in the middle of writing a new article for MSExchange.org when I received an e-mail from Microsoft saying I was awarded the Microsoft Most Valuable Professional (MVP) 2012 for Exchange!     :)

This was the first time for me and I am really and truly honored to receive this award!
I want to thank everyone who reads this blog and my scripts on TechNet, my fellow MVP Ratish Nair from the great MSExchangeGuru.com, everyone on MSExchange.org, Cristina Gonzales (my MVP Lead) and Microsoft for this award and for the amazing product that Exchange is!

I promise to keep sharing everything I know and learn and to do even more for the community! I hope my articles and blog posts are useful and if you think there is anything I can improve or if you would like to see some particular topic on this blog, please just let me know!

According to About MVP:
“The Microsoft MVP Award recognizes exceptional technical community leaders from around the world who voluntarily share their high quality, real world expertise with others. Microsoft MVPs are a highly select group of experts representing technology's best and brightest who share a deep commitment to community and a willingness to help others. Worldwide, there are over 100 million participants in technical communities; of these participants, there are fewer than 4,000 active Microsoft MVPs.
(...)
As the most active, expert participants in technical communities, MVPs are recognized and awarded for their inspirational commitment to technical communities.

In order to receive the Microsoft MVP Award, MVP nominees undergo a rigorous review process. Technical community members, current MVPs, and Microsoft personnel may nominate candidates. A panel that includes MVP team members and product group teams evaluate each nominee's technical expertise and voluntary community contributions for the past year. The panel considers the quality, quantity, and level of impact of the MVP nominee's contributions. Active MVPs receive the same level of scrutiny as other candidates each year."


Thank you Microsoft!

Thursday, June 28, 2012

Disable AutoForwarding Rules

A problem many companies face is users who automatically forward all their e-mails to external addresses. The easiest way to prevent this is to use the Set-RemoteDomain cmdlet which is used to configure a managed connection for a remote domain. In this case, we will configure the Default Remote Domain (with an address space of “*”) which is the remote domain related to the Internet (if you changed its name or created a different one, please update the code):
Set-RemoteDomain Default –AutoForwardEnabled $False

Please note, however, that this will block any messages that are auto-forwarded by client e-mail programs in your organization from being sent to the internet, for everyone!

Monday, June 18, 2012

Microsoft Lync Server 2010 Protocol Workloads Poster

A new version (5.12 – June 2012) of this great poster is now available. It shows each workload in Microsoft Lync Server 2010 communications software, describing relationships, dependencies, flow of information and certificate requirements.
This new version adds more details to the Enterprise Voice workload based on feedback from several Lync experts.

Get it now from the Download Center.

Sunday, June 17, 2012

TechEd North America 2012 - Exchange 2010 Videos

TechEd North America 2012 is now over and, as usual, you can find online many of the presentations. HERE are some great videos regarding Exchange.

Empty Poison Queues

If for some reason you have e-mails in a Poison Queue and you can’t get rid of them using the Exchange Management Shell [EMS] or Console [EMC], here is another method:
1. Open the Windows Services MMC;
2. Find the Microsoft Exchange Transport service and Pause it;
3. Open the EMS and run Get-Queue –Server <server_name> until all the queues are empty (except for the Poison queue);
4. Once all queues are empty stop the Microsoft Exchange Transport service;
5. Navigate to the location where your transport database is located (by default C:\Program Files\Microsoft\Exchange Server\V14\TransportRoles\data\Queue\) and delete all files in that folder;
6. Start the Microsoft Exchange Transport service.


Exchange will create a brand new database and your Poison queue will be cleared!

Tuesday, June 12, 2012

Error with your new mobile phone partnership

By default Exchange 2010 SP1 limits the number of mobile devices each user can connect to Exchange to 10. This is done by a Throttling Policy but it is not limited just to ActiveSync [EAS].
A Throttling Policy allows administrators to limit the amount of resources each user can take to avoid possible performance issues. In regards with EAS, a policy can control 6 parameters:
• EASMaxConcurrency
• EASPercentTimeInAD
• EASPercentTimeInCAS
• EASPercentTimeInMailboxRPC
• EASMaxDevices
• EASMaxDeviceDeletesPerMonth

The one we are interested is EASMaxDevices which together with EASMaxConcurrency are the only ones set by default.

If the limit of 10 is reached, a user will receive the following message on the device he/she is trying to synchronize (in this case I changed the limit to 1 for testing):


To overcome this limitation, you can increase this limit using the Set-ThrottlingPolicy cmdlet. For example, to change it to 25, run the following cmdlet:
Set-ThrottlingPolicy <policy_name> –EASMaxDevices 50

If you don’t want to increase everyone’s limit, you can create a new Throttling Policy, increase its limit and assign it to the user(s) you want:
New-ThrottlingPolicy "Increased EAS" -EASMaxDevices 25
Set-Mailbox Nuno -ThrottlingPolicy "Increased EAS"

Alternatively you can delete any devices that you no longer need to sync with Exchange, if any. To achieve this, login to Outlook Web App, go to Options -> Phone -> Mobile Phones and delete any unused partnerships to reduce the number of devices associated with your account.

For more information: Set-ThrottlingPolicy

Wednesday, June 6, 2012

Archive Mailbox Statistics

Although Personal Archives in Exchange 2010 are often in cheaper storage than “normal” mailboxes, we still need to keep an eye on them to check how archives are growing and how (if!) users are using it.

Here’s a simple script to get some statistics regarding all the archive mailboxes in your environment:
$mbcombCollection = @()

$archiveMbxs = Get-Mailbox -Archive -ResultSize Unlimited | Select Identity, ArchiveWarningQuota, ArchiveQuota
ForEach ($mbx in $archiveMbxs)
{
 $mbxStats = Get-MailboxStatistics $mbx.Identity -Archive | Select DisplayName, StorageLimitStatus, TotalItemSize, TotalDeletedItemSize, ItemCount, DeletedItemCount, Database

 $mbcomb = "" | Select "Display Name", StorageLimitStatus, "TotalItemSize (MB)", "TotalDeletedItemSize (MB)", ItemCount, DeletedItemCount, Database, "ArchiveWarningQuota (GB)", "ArchiveQuota (GB)"

 $mbcomb."Display Name" = $mbxStats.DisplayName
 $mbcomb.StorageLimitStatus = $mbxStats.StorageLimitStatus
 $mbcomb."TotalItemSize (MB)" = [math]::round($mbxStats.TotalItemSize.Value.ToMB(), 2)
 $mbcomb."TotalDeletedItemSize (MB)" = [math]::round($mbxStats.TotalDeletedItemSize.Value.ToMB(), 2)
 $mbcomb.ItemCount = $mbxStats.ItemCount
 $mbcomb.DeletedItemCount = $mbxStats.DeletedItemCount
 $mbcomb.Database = $mbxStats.Database
 $mbcomb."ArchiveWarningQuota (GB)" = $mbx.ArchiveWarningQuota.Value.ToGB()
 $mbcomb."ArchiveQuota (GB)" = $mbx.ArchiveWarningQuota.Value.ToGB()

 $mbcombCollection += $mbcomb
}

#$mbcombCollection
$mbcombCollection | Export-Csv D:\Scripts\Reports\"ArchiveStats_$(Get-Date -f 'yyyyMMdd').csv" -NoType

Hope this helps!

Tuesday, May 22, 2012

Exchange Server 2010 SP2 Help (May 2012)


The latest Help file for Exchange 2010 SP2 from May 2012 is now available for download from here.

Monday, May 21, 2012

Forwarded External Emails Don’t Display Sender’s Address

After migrating thousands of mailboxes from Exchange 2007 to 2010, only recently came to my attention a bug in the whole process.

Let’s say we have a user (call it UserA) that has a rule to automatically forward every e-mail received to his assistant (UserB):
 


Using the scenario above, with Exchange 2007 when an external e-mail is received by UserA and forwarded automatically by the Outlook rule to UserB, this will receive the e-mail like this:

Note that the e-mail address of the external recipient is displayed.


However, with Exchange 2010 the same thing doesn’t seem to happen!... Running the exact same test with both users now on Exchange 2010, UserB receives the e-mail like:

Note that my external e-mail address is not displayed so UserB has no way of replying to the sender!


Workaround
There are two main workarounds for this:

1. Update the Outlook rule to use one of the following actions instead: “forward it to people or distribution list as an attachment” or “redirect it to people or distribution list”:

However (1) the e-mail will be received as an attachment which means it is an extra step for UserB to read the e-mail and (2) the e-mail will be received by UserB as having been sent directly from the external sender to him/her, when it was actually sent to UserA...


2. At the Exchange level, enable the auto forward feature from UserA to UserB (make sure “Deliver message to both forwarding address and mailbox” is also selected so that both UserA and UserB receive the e-mail):


However this only allows you to specify one user and although the e-mail received has the sender’s e-mail address, it looks different:
For me, this is the best workaround for overcome this issue, but I guess it’s all up to the user how he/she prefers it.

You could specify a second user by using the Shell instead and a little "cheat":
Set-Mailbox UserA -ForwardingAddress userc@letsexchange.com -DeliverToMailboxAndForward $true


Reason for This?!
It turns out this only happens for mailboxes migrated from Exchange 2007 to 2010. If a mailbox is created on 2010, it works as expected with the sender’s e-mail address being displayed!

According to Microsoft, this issue was recorded as a bug and was closed as “Won't Fix”, so I don’t expect it to get fixed any time soon...

It is hard to believe that with so many costumers and millions of mailboxes migrated from Exchange 2007 to 2010 all over the world, Microsoft is not planning to fix this, so I am still trying to find out if this is actually the case.


At the time of this post, I am running Exchange 2010 SP2 RU2.

Tuesday, May 15, 2012

Microsoft DirSync Force Directory Synchronization

Recently I have been working on Office 365 and AD FS and at this stage I keep creating, changing and deleting accounts. By default the Microsoft Online Services Directory Synchronization Tool synchronizes changes made to the Active Directory user accounts to those in the Microsoft Online Services directory every 3h, which is a long time for me to wait...

If you are testing something or want to immediately disable someone’s account (maybe because their contract has terminated), you will want these changes synchronized as soon as possible (like me).
To achieve this, you have to manually force a directory synchronization by running the Microsoft Online Services Directory Synchronization Configuration Wizard again or by using the Directory Synchronization PowerShell cmdlet.

To force directory synchronization using the Configuration Wizard:
  1. On the computer that is running the Microsoft Online Services Directory Synchronization tool, click Start -> All Programs -> Microsoft Directory Synchronization and then click Directory Sync Configuration;
  2. Follow the instructions in the wizard and provide the requested credentials;
  3. On the Finished page of the wizard, select Start directory synchronization now, and then click Finish.


To force directory synchronization using PowerShell:
  1. On the computer that is running the Directory Synchronization tool, navigate to the directory synchronization installation folder, %programfiles%\Microsoft Online Directory Sync (by default), and then run DirSyncConfigShell.psc1 to open a PowerShell window;
  2. In the PowerShell window type Start-OnlineCoexistenceSync and then press Enter.



To double check that the synchronization worked, login to your Office 365 portal and click in Users. In here you will see when the last synchronization happened:



Another option is to change how often the directory synchronization occurs. To change this:
  1. On the computer that is running the Directory Synchronization tool, navigate to the directory synchronization installation folder, %programfiles%\Microsoft Online Directory Sync (by default);
  2. Open the Microsoft.Online.DirSync.Scheduler.exe.Config file for editing;
  3. Update the value of the SyncTimeInterval key with the interval that you prefer (the value is expressed in hours, minutes and seconds).



Hope this helps!

Monday, May 7, 2012

Update IPs on Receive Connectors

If you have multiple HUB servers and ever had to update one or more IP addresses from a custom Receive Connector, you know how much work it is involved. Especially if you have to do this often.
If this is your case, here’s how you can easily remove (or add) IPs from a receive connector across all your HUB servers:
# Get Receive Connectors to update
$recCons = Get-ReceiveConnector | Where {$_.Name -match "Unauthenticated SMTP"}

ForEach ($recCon in $recCons)
{
   Write-Host "Updating", $recCon.Identity

   $recCon.RemoteIPRanges -= "10.101.74.10"
   $recCon.RemoteIPRanges -= "10.102.34.12"

   Set-ReceiveConnector $recCon -RemoteIPRanges $recCon.RemoteIPRanges
}
Hope this helps!

Exchange 2007 Cmdlet List

Have you ever wished for a website that had all the Exchange cmdlets in one page so that you could easily search for a cmdlet or even find new ones? Well, such page exists on TechNet! If you go to the Cmdlet List webpage, you will get all the cmdlets that manage features of Exchange Server 2007 together with the server roles on which they are used!

Wednesday, April 25, 2012

Receive Connector Rejected an Incoming Connection

On an Exchange server, you might get the error below if you have a server or an application creating more than 20 concurrent connections to a custom Receive Connector:

Log Name:      Application
Source:        MSExchangeTransport
Date:          04/20/2012 16:15:52
Event ID:      1021
Task Category: SmtpReceive
Level:         Warning
Keywords:      Classic
User:          N/A
Computer:      HTCAS1.letsexchange.com
Description:
Receive connector "Unauthenticated SMTP" rejected an incoming connection from IP address xxx.xxx.xxx.xxx. The maximum number of connections per source (20) for this connector has been reached by this source IP address.

This means that you have a large number of connections coming from the same IP address. To prevent connections from being rejected, if this volume of connections is normal, you have to change the maximum number of connections per source.

To check the current limit (20 by default), run the following cmdlet and look for MaxInboundConnectionPerSource:
Get-ReceiveConnector <server_name>\<name> | Select *MaxInbound*

To increase the limit, you have to use the Exchange Management Shell:
Set-ReceiveConnector <server_name>\<name> -MaxInboundConnectionPerSource 500 -MaxInboundConnectionPercentagePerSource 100

If you have the same receive connector in multiple servers, you can run the following cmdlet instead to update all at the same time and in one go:
Get-ReceiveConnector *\<name> | Set-ReceiveConnector -MaxInboundConnectionPerSource 500 -MaxInboundConnectionPercentagePerSource 100

Hope this helps!

Sunday, April 22, 2012

Email Latency

If you want to find out the overall latency for e-mails flowing in your Exchange 2007 organization, you can use the MSGAnalyzer tool from Microsoft or you have to check when an e-mail first reached your servers, check when it was delivered to the recipient’s mailbox and then calculate the time difference.

The good news is that with Exchange 2010 this is much, much easier as this information is saved in the Message Tracking Logs. When a HUB server delivers a message (through the Store Driver) it generates a DELIVER event which contains the TimeStamp of when the message was delivered (as with Exchange 2007) but now it also includes the MessageLatency which is the difference between the original arrival time of the message and this timestamp.

So, if you want to check the latency for all the e-mails arriving in your organization, simply use the a cmdlet similar to the following one:

Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -Start "03/26/2012" -EventID DELIVER | FT MessageLatency

Which will give you a TimeSpan value like “00:00:03.8130000” which means the e-mail took almost 4 seconds to be delivered.

If you are just interested in a particular day and also want to know which HUB server delivered it each message:
Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -Start "03/26/2012" -End "03/27/2012" -EventID DELIVER | Select TimeStamp, ClientHostname, @{Label="LatencyMil"; Expression={$($_.MessageLatency).TotalMilliseconds}} | Export-Csv Latency_20120326.csv -NoTypeInformation

Note that this time we are printing the TotalMilliseconds it took to deliver each message which makes it easier to calculate the average for the day in Excel.

Thursday, April 19, 2012

Mailbox Item Count

Ever wondered how many items all the mailboxes in your Exchange environment currently have? Getting a weekly count of these, together with the total mailbox size, might be useful so you get a trend on your environment’s growth.
For a single mailbox, you can simply use the following cmdlet:
Get-MailboxStatistics user1 | Select ItemCount
Or if you want to get a count per database for example:
Get-MailboxStatistics –Database MDB1 | ForEach {$totalItems += $_.ItemCount}
$totalItems
If you want for every single mailbox in your environment, you can use the following cmdlet:
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Select ItemCount | ForEach {$totalItems += $_.ItemCount}

Thursday, April 5, 2012

2012 PowerShell Scripting Games

I should have posted this a long time ago, but better late than never!...   :)
The good news is that you can still participate as the deadline for the first event is only next Sunday/Monday.
2012 Windows PowerShell Scripting Games: All Links on One Page

2012 Scripting Games

Wednesday, March 28, 2012

Auditing Mailbox Access in Exchange 2010


In every organization, there are always mailboxes with sensitive information. These might be the mailboxes of the CEO, directors, users from the HR or Payroll departments, or simply mailboxes for which you have to perform discovery actions to demonstrate compliance with regulatory or legal requirements. Although normally administrators are not concerned with the content of user’s mailboxes, there might be someone less honest that attempts to access someone’s mailbox in order to obtain information of value for their own benefit.

Previous versions of Microsoft Exchange did not provide a full range of compliance capabilities. Managed Folders or Journaling simply were not enough to perform basic audits or to be fully compliant with legislation such as the Sarbanes-Oxley Act. Exchange 2010 introduces some welcomed new features, including Retention and Litigation Hold, Single Item Recovery or Archiving.

In the following article, we will explore yet another new feature introduced in SP1 known as Auditing Mailbox Access, which allows us to record operations on a mailbox such as the deletion or copy of e-mails: Auditing Mailbox Access on MSExchange.org

Sunday, March 25, 2012

Exchange Build Numbers

Ever wondered what all those build numbers like 8.3.083.6 or 14.2.247.5 in your exchange environment are exactly? The following webpage lists all the Exchange Server versions and release dates since Exchange 2003 as well as all the Update Rollup's, release date and their KB since Exchange 2007: Exchange Server and Update Rollups Builds Numbers