O-Xchange Notes from the Field!

Friday, January 31, 2014

Resetting Exchange Calendar on IOS Device when IOS Calendar is out of sync

​Scenario: You have an IOS device where the calendar is out of sync with the Exchange calendar. There may be duplicate appointments, missing appointments, or appointments that do not relfect changes.
Solution:  Instead of removing the mail account from the IOS device, Turn off the calendar and turn back on the calendar via the mail profile to initiate a fresh sync.
1. On the IOS device, tap Settings.
2. Tap Mail, Contacts, Calendars.
3. Tap your Exchange account.
4. Tap on Calendar to disable it.
5. Tap on Delete from My iPhone as all the calendar info will be removed from your phone.
6. Wait a minute and then turn the calendar back on.

Thursday, January 30, 2014

Exchange ActiveSync Mailbox Logging

Enable ActiveSync logging on a mailbox:
Set-CASMailbox alias -ActiveSyncDebugLogging:$true
Retrieve ActiveSync Logging:
Via email:
Get-ActiveSyncDeviceStatistics -Mailbox alias -GetMailboxLog:$true -NotificationEmailAddress yourEmailAddress@contoso.com
Via a Text Files for each device:
*Run the below from an account that is not mail enabled if you wish to receive no email*
Get-ActiveSyncDeviceStatistics -Mailbox alias -GetMailboxLog:$true | Where {$_.DeviceID -like "ApplXXXXXXXXXXXX"} | Export-CSV\\Server\Share\filename.txt
 Verify if ActiveSyncDebugLogging is enabled:
Get-CASMailbox alias -ActiveSyncDebugLogging | Select ActiveSyncDebugLogging

Wednesday, January 29, 2014

Some Powershell One-Liners

​Run this one liner command to disable client access to a mailbox
Set-CASMailbox "testmbox" -EwsEnabled $false -ActiveSyncEnabled $false -MAPIEnabled $false -OWAEnabled $false -ImapEnabled $false -PopEnabled $false

Disable single item recovery and remove the mailbox from litigation hold.
Set-Mailbox "Mickey Mouse" -SingleItemRecoveryEnabled $false -LitigationHoldEnabled $false

Copy items from the Recoverable Items folder to a folder in the Discovery Search Mailbox and delete the contents from the source mailbox.
Search-Mailbox -Identity "testmbox" -SearchDumpsterOnly -TargetMailbox "Discovery Search Mailbox" -TargetFolder "GurinderSingh-RecoverableItems" -DeleteContent
If you need to delete only messages that match specified conditions, use the SearchQuery parameter to specify the conditions. This example deletes messages that have the string "card statement" in the Subject field.
Search-Mailbox -Identity "testmbox" -SearchQuery "Subject:'card statement'" -SearchDumpsterOnly -TargetMailbox "Discovery Search Mailbox" -TargetFolder "testmbox-RecoverableItems" -DeleteContent

Messages not showing as read after reading

Outlook inbox not updating when sorted by categories.

Out of Office with PowerShell

Setting OOF for a mailbox. Run this command
Simple OOF
Set-MailboxAutoReplyConfiguration USERID -AutoReplyState Enabled –ExternalMessage "Message that you want to go out.” –InternalMessage "Message that you want to go out.”
To schedule run
Set-MailboxAutoReplyConfiguration USERID –AutoReplyState Scheduled –StartTime “12/19/2013” –EndTime “4/30/2014” –ExternalMessage "Message that you want to go out.” –InternalMessage "Message that you want to go out.”
To Check run
Get-MailboxAutoReplyConfiguration USERID

More Information

Sending mass emails with powershell

​This sends 5 emails, adjust 5 to whatever number of emails you want to send.
​$i = 1
do {Send-MailMessage -smtpServer 'emailserver' -from 'email address' -to 'email address' -subject 'your subject here' -body 'Hi' ; $i++}
while ($i -le 5)

Reporting Mailbox Folder sizes with Powershell

​Reporting Mailbox Folder sizes with Powershell

report on individual folders and sizes:
Get-MailboxFolderStatistics testmbox

get folder stats and display folder size and items in folder:
Get-MailboxFolderStatistics testmbox | Ft name,FolderSize,ItemsinFolder

look at specific folders and sub folders:
Get-MailboxFolderStatistics testmbox -FolderScope Inbox | Select Name,FolderSize,ItemsinFolder

Tuesday, January 28, 2014

Exchange Script: Find ActiveSync Device Statistics for users in a Distribution Group

Scenario: You want to Find ActiveSync Device Statistics for users that are in a Distribution Group. If the Distribution Group does not contain members, it will not send the email. If it contains members, it will send an email for each member. Copy the content below and paste it into a .ps1 file and execute from Exchange Mangaement Shell.   

$mbox = Get-DistributionGroup "group-name"| Get-DistributionGroupMember
If ($mbox -ne $null)
$email = $mbox | ForEach {
$name = $_ | Select Name |Out-String
$body = get-activesyncdevicestatistics -mailbox $_.name | Sort DeviceFriendlyName | FT DeviceFriendlyName, DeviceModel, LastSyncAttemptTime, LastSuccessSync | Out-string
$SmtpClient = new-object system.net.mail.smtpClient
$MailMessage = New-Object system.net.mail.mailmessage
$SmtpClient.Host = "servername"
$mailmessage.from = ("EASMonitoring@domain.com")
$mailmessage.Subject = "EAS Statistics"
$mailmessage.Body = "
EAS Statistics for:$name

Monday, January 27, 2014

IMAP/POP Certificate issue after Install of Ex2013 CU3

Scenario: After the installation​ of Ex2013 CU3, the certificate that was assigned the POP and IMAP services became unassigned and assigned to another certificate.  The error clients were receiving:
"IMAP Error: Server Certificate was rejected by the verifier because the certificate's common name 'mail.domain.com' does not match the hostname 'imap.domain.com'.
Resolution:  From Ex2013 Management Shell, run the following: 
1. Determine the thumbprint of the certificate that should have IMAP and POP enabled by running: Get-ExchangeCertificate 
2. Then run: Enable-ExchangeCertificate -Thumbprint XXXXXXXXXX -Services POP,IMAP
3. Restart the Imap and Pop frontend and backend services.

Wednesday, January 15, 2014

Exporting and Importing Mailbox in 2010 SP1

Please trefer to any of the following links:

Export or manually archive Outlook for Mac items

Export or manually archive Outlook items in Outlook for MAC 2011



Redistribute Exchange Databases

​To redistribute Exchange databases so they are mounted on the Mailbox Server that holds the first activation preference, run the following:

1. Open up Exchange Management Shell
2. Change the directory to the Scripts folder located in the Exchange Install Directory; 
Example: CD  "C:\Program Files\Microsoft\Exchange Server\V14\Scripts"
3. Run the following command:
 .\RedistributeActiveDatabases.ps1 -DagName <dagname> -BalanceDbsByActivationPreference –ShowFinalDatabaseDistribution –Confirm:$false
 Note: To find the DagName, you can run the get-databaseavailabilitygroup powershell command to list your Dags.

Tuesday, January 14, 2014

you cannot make changes to the contents of this read only folder

Issue: Customer reported this error while trying to remove a calendar appointment for her manager in Outlook 2010.
"you cannot make changes to the contents of this read only folder"
customer manages lots of calendars for several managers. The managers have given admin rights to this customer

Resolution: Reconfigured Outlook 2010 for Online mode. Customer was using Outlook in cache mode

Monday, January 13, 2014

Importing pst to mailbox

Scenario: Import pst into a mailbox
Note: Must have mailbox export/import permissions to be able to do this. targetrootfolder is good if you are importing multiple psts into the mailbox. This way content is not merged under existing folders.

From Powershell, type:
New-MailboxImportRequest -Mailbox newmbox -filepath \\server\pstfiles\newmbox.pst-BadItemLimit 50 -T
argetRootFolder "Mailbox -newmbox"

Thursday, January 9, 2014

Allow this website to configure server settings

​Issue: Customer gets a prompt while in Outlook saying
"Allow this website to configure user@user.edu server settings ?
https://autodiscover.domain.edu/autodiscover/autodiscover.xml. Your account was redirected to this website for settings. You should only allow settings sources you know and trust

Resolution: Click on Don't ask me about this website again box. Click on Allow
In some cases, recreating the profile can fix the issue

​Troubleshooting Outlook login Prompt Issues

​Below are some of the steps you can use to troubleshoot Outlook login Prompt Issues

Step 1: Download and Install Netmon on the PC having the issue
2)        Install Network Monitor on the appropriate server/client.
3)        Start the Network Monitor tool, there will be a shortcut on your Start menu under Programs. Right click and "Run as administrator" in elevated mode.
4)        From the “Tools” -> “Options” ensure that the Temporary capture file size is set to at least 200mb on servers.
5)        Start Netmon on the appropriate servers/client, and reproduce the issue.
a.        Click "Create New capture" on the left pane.
b.        Click the Play button ">" to begin the capture.
6)        Stop Netmon after the issue is reproduced by hitting the stop button.
7)        Upload the cap files.
Step 2:  Enable Outlook Logging
Enable Outlook Logging Client Side:
For Outlook 2007:
On the Tools menu, click Options.
On the Other tab, click Advanced Options.
Click to select the Enable mail logging (troubleshooting) check box in Outlook 2003 and the Enable logging (troubleshooting) check box in Outlook 2007, and then click OK two times.
For Outlook 2010:
On the File tab, click Options.
In the Outlook Options dialog box, click Advanced.
In the Other section, select the Enable troubleshooting logging(requires restarting Outlook) check box, and then click OK.
Exit and then restart Outlook.s
Step 3: Disable Encryption on outlook
a.Click Start, click Run, type control, and then click OK.
b.Double-click Mail, and then click Show Profiles.
c.Select your profile, and then click Properties.
d.Click E-mail Accounts, select View or Change Existing E-mail Accounts, and then click Next.
e.Select the Exchange account, and then click Change.
f.Click More Settings, and then click the Security tab.
g. Disable  the  checkbox "Encrypt data between Microsoft Office Outlook and Microsoft Exchange Server check box."
h.Click OK, click Next, click Finish, and then click Close.
Outlook in Online Mode
 Turn Cached Exchange Mode off
1.       On the Tools menu, clickAccount Settings.
2.       On the E-mail tab, click the Exchange account, and then click Change.
3.       Under Microsoft Exchange server, clear the Use Cached Exchange Mode check box.
4.       Exit and restart Office Outlook 2007.
Step 5: Add host file entry on outlook client machine to single CAS server
Note: Before you run netmon, please contact an engineer on the support team so netmon on can be started on the cas server. The netmon trace needs to happen simultaneously
Step 6: Gather the ETL Log files & the capture files from Netmon
Note: Outlook generates a new ETL file each time you start Outlook with logging enabled. Therefore, it is important to control the repro scenario so you know which log file(s) to collect from the computer. Please don’t copy all the ETL files in the \Temp folder.
 The log files are generated in the following format:
 OLKRPCLOG_<month>_<day>_<year>_<hour - 24 hr clock>_<minutes>_<seconds>_<index>.etl
 For example: OLKRPCLOG_09_06_2008_17_35_47_1.etl
Gather and upload the logs/trace files to Microsoft for analysis

Wednesday, January 8, 2014

Activesync mailbox log analysis using MFCMAPI

Activesync mailbox log analysis using MFCMAPI



Tuesday, January 7, 2014

Display date on Outlook items in Drafts Folder

​If you need to see the date items were added to the drafts folder, you will need to use a custom view and add modified date field to the view and sort by it

The default view uses sent date field, whcih is blank and displayed as none, because the message hasn't been sent yet.

So follow these steps to add modified date to othe view

  1. Right click on the row of field names at the top of the message list, were it reads "Arrange By: Date"
  2. Choose View Settings (Outlook 2010) or Custom (Outlook 2007 and older)
  3. Click the Columns (or Fields) button to open the Show Columns dialog
  4. Select date/Time fields from the "Select available columns from" menu
  5. Click on modified and Add to add it to the view then close the dialog
  6. Click on modified column to sort by modified date

RDP screen goes black or white after successful remote login on windows server 2012

Issue: RDP screen goes black or white after successful remote login on windows server 2012
Press Ctrl-Alt-End, then click on signout
Log back in. Issue should be fixed. problem might be caused by screen resolution of the rdp connection

Working with Recoverable Items Folder

​The Recoverable Items folder (known in earlier versions of Exchange as the dumpster) exists to protect from accidental or malicious deletions and to facilitate discovery efforts commonly undertaken before or during litigation or investigations

To retrieve the following quota settings:

* RecoverableItemsQuota
◦ RecoverableItemsWarningQuota
◦ ProhibitSendQuota
◦ ProhibitSendReceiveQuota
◦ UseDatabaseQuotaDefaults
◦ RetainDeletedItemsFor
◦ UseDatabaseRetentionDefaults
use this one liner:
Get-Mailbox "testmbox" | Format-List RecoverableItemsQuota, RecoverableItemsWarningQuota, ProhibitSendQuota, ProhibitSendReceiveQuota, UseDatabaseQuotaDefaults, RetainDeletedItemsFor, UseDatabaseRetentionDefaults
2.To retrieve the current size of the Recoverable items folder:
Get-MailboxFolderStatistics "testmbox" -FolderScope RecoverableItems | Format-List Name,FolderAndSubfolderSize
please note that quota for recoverable items folder can be raised.The default is 30GB
To make sure no items are deleted from the Recoverable Items folder, increase the Recoverable Items quota. You can also increase the Recoverable Items warning quota, and set the deleted item retention period to a value higher than the current size of the user's Recoverable Items folder. This is particularly important for preserving messages for mailboxes placed on In-Place Hold or litigation hold. It's recommended to raise these settings to twice their current size.
3. Increase recoverable items quota
Set-Mailbox "testmbox" -RecoverableItemsQuota 80Gb -RecoverableItemsWarningQuota 80Gb -RetainDeletedItemsFor 3650 -ProhibitSendQuota 80Gb -ProhibitSendRecieveQuota 80Gb -UseDatabaseQuotaDefaults $false -UseDatabaseRetentionDefaults $false

4. This example retrieves the size of the Recoverable Items folder and its subfolders and an item count in the folder and each subfolder.
Get-MailboxFolderStatistics -Identity "Mickey Mouse" -FolderScope RecoverableItems | Format-Table Name,FolderAndSubfolderSize,ItemsInFolderAndSubfolders -Auto

Search IIS logs for ActiveSync data for specific user accounts.

Scenario: You want to find ActiveSync activity for specific users that is stored in IIS logs on the Exchange Servers.
Using LogParser you can edit and run the following command:
logparser "Select * from '\\servername\c$\inetpub\logs\logfiles\w3svc1\*.log' Where cs-uri-stem LIKE '%Microsoft-Server-ActiveSync%' AND (cs-uri-query LIKE '%username1%' OR cs-uri-query LIKE '%username2%')" -i:IISW3C -q:on >\\FilePath\filename.txt

HTTP 413 Errors in IIS logs with ActiveSync and Certificate Based Authentication

Scenario: After setting up Certificate Based Authentication for ActiveSync, users on mobile devices may experience the following error message: "Cannot Send Mail.The message was rejected by the server because it is too large". When you check the IIS logs, you may see HTTP 413 errors. Our Environment: Exchange 2013, Windows Server 2012, IIS 8.0.
Reason: The client connection was dropped to prevent DeadLock. The server requests renegotiation for certificate authentication, and the content length the client is trying to send is larger than the value of the UploadReadAheadSizemetabase property in IIS.
WorkAround: The workaround below will re-bind the certificate to enable client certificate negotiation upfront.
Re-bind the certificate and enable ClientCertNegotiation:
1. netsh http show sslcert <-- Copy the results to notepad.
2. netsh http delete sslcert hostnameport=<hostnameport>:443
3. netsh http add sslcert hostnameport=<hostname>:443 certhash=<certhash> appid=<appid> certstorename=MY clientcertnegotiation=enable <-- Use copied results from step 1 to fill in these values)
Note: We have a separate IIS Site with EAS setup for Certificate Based Authentication. We use a separate certificate on this site so we can enable clientcertnegotiation on the certificate. Another work around would be to change the UploadReadAheadSize on the Web Server, the website that hosts the EAS subsite, and the EAS subsite.

Monday, January 6, 2014

​Exchange server and Update rollup numbers

​Error moving user to Office 365 (onboarding)

​Error moving user to Office 365 (onboarding)
"The user doesn't have a matching SMTP address with target destination domain"
User has a mailbox on prem and need to be onboarded to Office 365
Resolution: Run dirsync and ensure user is fully synced. The mailbox on prem must have corresponding mail user in Office 365. Move was successful after dirsync

Thursday, January 2, 2014

something went wrong UserHasNoMailboxException

Issue: Customer couldn't access office 365 mailbox using the unified URL and kept getting "something went wrong, user has nomailboxexception" errors.

Notes: Customer was running hybrid configuration with Office 365 and Exchange 2013. Also the mailbox is a remote mailbox

Resolution: TargetOWAURL for the organization relationship at customer site was
Issue was resolved when customer modified remote routing address of the remote mailbox to user@servicedomain.edu
The service domain in the target OWA url needs to match the remote routing address of the remote mailbox

Exporting Mailbox to a PST File

​Exporting mailbox to a PST File
Note: Must have the "Mailbox Import Export" role assigned
From powershell, type New-MailboxExportRequest -mailbox testmbox -name -filepath\\servername\pstfiles\testmbox.pst

This will export all folders and data in each and export it into the specified PST file. Also note that the dumpster will also be exported by default.
If you want to get additional details about the mailbox export request, you can use the Get-MailboxExportRequest or Get-MailboxExportRequestStatistics cmdlet.
if the export fails to complete, you can add -baditemlimit for eg
New-MailboxExportRequest -mailbox testmbox -name -filepath\\servername\pstfiles\testmbox.pst -baditemlimit 50