Scenario: A user has found a missing mobile device. While the device was missing, the user has initiated a remote wipe on it. We want to prevent the remote wipe from occurring when the phone is powered back on.
Solution: Run this via Exchange Management Shell:
clear-activesyncdevice <identity> -cancel:$true
Note: I tried running the -cancel $true as stated in the article, but I received this error:
A positional parameter cannot be found that accepts argument 'True'. I replaced it with -cancel:$true
Microsoft Article Reference

The O-Xchange team actively blogs useful information or solutions to problems in the IT world with particular focus on Microsoft Windows servers, Exchange servers, Lync, Skype for Business, Networking, Security, Software Development, Digital Media, Tools, Tips/Tricks, Scripts, etc. Looking for job? Go to http://recruit.o-xchange.com
Wednesday, May 28, 2014
Friday, May 23, 2014
Rebuild the Content Index for an Exchange Database
Within Exchange Powershell, change the Directory to the scripts directory of your Exchange Install Location. Run either of the following commands to rebuild the content index for a single database or all databases on a single server:
.\resetsearchindex.ps1 -force <database>
or
.\resetsearchindex.ps1 -force -all
.\resetsearchindex.ps1 -force <database>
or
.\resetsearchindex.ps1 -force -all
Check the last transaction log file that was written into the Exchange database.
The Exchange store uses write-ahead transaction logs and checkpoint files to help prevent data loss. Transaction logs record all the changes that have been committed to the in-memory database, while checkpoint files record which logged transactions have been written to the on-disk database files.
To check the last log file that has been written to the on-disk database, you can run the following in Exchange PowerShell. It will provide the Checkpoint file that was last committed. Any log files after that checkpoint file have not been committed to the on-disk database yet, where any log files prior have already been written and can be safely removed if manual purge is required.
Powershell: ESEUTIL /MK E:\Database\Logs\E00.chk
Results:
Extensible Storage Engine Utilities for Microsoft(R) Exchange Server
Version 14.03
Copyright (C) Microsoft Corporation. All Rights Reserved.
Initiating FILE DUMP mode...
Checkpoint file: E:\Database\logs\E00.chk
LastFullBackupCheckpoint: (0x0,0,0)
Checkpoint: (0x4E1617,80,0) <-- The log file may look like E00004E1617.log in the logs directory.
FullBackup: (0x4D48C3,173,1E1)
FullBackup time: 05/18/2014 06:01:36
IncBackup: (0x4E0CB3,447,48)
IncBackup time: 05/23/2014 05:04:41
Signature: Create time:06/05/2012 15:17:03 Rand:89681821 Computer:
Env (CircLog,Session,Opentbl,VerPage,Cursors,LogBufs,LogFile,Buffers)
( off, 2027, 101350, 16384, 101350, 2048, 2048,1804596)
Operation completed successfully in 0.32 seconds.
Reference
To check the last log file that has been written to the on-disk database, you can run the following in Exchange PowerShell. It will provide the Checkpoint file that was last committed. Any log files after that checkpoint file have not been committed to the on-disk database yet, where any log files prior have already been written and can be safely removed if manual purge is required.
Powershell: ESEUTIL /MK E:\Database\Logs\E00.chk
Results:
Extensible Storage Engine Utilities for Microsoft(R) Exchange Server
Version 14.03
Copyright (C) Microsoft Corporation. All Rights Reserved.
Initiating FILE DUMP mode...
Checkpoint file: E:\Database\logs\E00.chk
LastFullBackupCheckpoint: (0x0,0,0)
Checkpoint: (0x4E1617,80,0) <-- The log file may look like E00004E1617.log in the logs directory.
FullBackup: (0x4D48C3,173,1E1)
FullBackup time: 05/18/2014 06:01:36
IncBackup: (0x4E0CB3,447,48)
IncBackup time: 05/23/2014 05:04:41
Signature: Create time:06/05/2012 15:17:03 Rand:89681821 Computer:
Env (CircLog,Session,Opentbl,VerPage,Cursors,LogBufs,LogFile,Buffers)
( off, 2027, 101350, 16384, 101350, 2048, 2048,1804596)
Operation completed successfully in 0.32 seconds.
Reference
Wednesday, May 14, 2014
Create new throttling policy to mitigate spam in your environment
Create new throttling policy to mitigate spam in your
environment
New-ThrottlingPolicy -Name Mitigatespam -RecipientRateLimit
10000 -MessageRateLimit 30 (similar to Office 365 settings)
Apply Policy to a particular OU
Get-Mailbox -OrganizationalUnit ‘domain/OUtest’
–resultsize unlimited | Set-Mailbox -ThrottlingPolicy MitigateSpam
Labels:
Exchange 2010,
Exchange 2013,
Powershell
PublicFolders health set is "Unhealthy" after you install Exchange Server 2013 Cumulative Update 3
Issue: PublicFolders health set is "Unhealthy"
after you install Exchange Server 2013 Cumulative Update 3
Scenario: Installed cu3 for exchange 2013, no public folder
mailboxes on exchange 2013, get-healthreport gives unhealthy status for public
folders
Resolution: Create an override for all servers using version bound
override
Add-GlobalMonitoringOverride -Identity
"Publicfolders\PublicFolderLocalEWSLogonEscalate" -ItemType "Responder"-PropertyName
Enabled -PropertyValue 0 -ApplyVersion "15.0.775.38"
Add-GlobalMonitoringOverride -Identity
"Publicfolders\PublicFolderLocalEWSLogonMonitor" -ItemType
"Monitor" -PropertyName Enabled -PropertyValue 0 -ApplyVersion
"15.0.775.38"
Add-GlobalMonitoringOverride -Identity
"Publicfolders\PublicFolderLocalEWSLogonProbe" -ItemType
"Probe" -PropertyName Enabled -PropertyValue 0 -ApplyVersion
"15.0.775.38"
Transport service won’t start on exchange 2010 server.
Issue: Transport service won’t start on exchange 2010
server.
Event log details: Transport Mail Database: MSExchangeTransport
has detected a critical storage error, updated the registry key
(SOFTWARE\Microsoft\ExchangeServer\v14\Transport\QueueDatabase) and as a
result, will attempt self-healing after process restart. Event id: 7001/17106
Resolution: Stopped transport service, remove queue
database, restart transport service
Giving Reviewer Rights to a calendar of a bunch of Exchange Mailboxes
To give calendar reviewer rights to a user called nosey1 to
bunch of mailboxes, use this one liner below. you will need to add their email
aliases
to a text file.
Get-content C:\scripts\Calperm.txt | ForEach-Object
{Add-MailboxFolderPermission $_":\Calendar" -User nosey1
-AccessRights Reviewer}
Labels:
Exchange 2010,
Exchange 2013,
Powershell
Add a Calendar Meeting in Outlook through Powershell
The link at the bottom of this blog contains a good script that will allow you to create calendar meetings in Outlook through PowerShell. This was helpful when I had to buildup a calendar in size to simulate another users exchange calendar for testing. Below are the changes I made to the script so I could add attachments into newly created calendar appointments. I know-I know, we shouldn't be adding attachments into the appointment directly, hence the reason for the simulation of the problems the user is experiencing that needs to be proven.
I added this parameter/variable in the list of parameters:
# Attachment Location, to hold value similart to: C:\folder\attachment.jpg
[string] $file
I added this scriptlet to the Process:
$attachment = new-object System.Net.Mail.Attachment $file
$newCalenderItem.Attachments.Add($file)
Boom. Now I can run the following command to create an appointment and add an attachment to build up the size of the calendar:
Add-CalendarMeeting -Subject "test recurring219" -Location "Steves Cube" -Body "Test" -MeetingStart "5/14/2014 18:00" -MeetingDuration 30 -file "C:\Users\username\Desktop\file\abstract.jpg"
Link to the Original Script for download.
Friday, May 9, 2014
Removing Duplicate Contact Items in a Exchange Mailbox
Scenario: You have a mailbox that has hundreds of copies of their contacts in their mailbox. For example, a user originally had 2500 contacts and now has 800,000 contacts because of the multiple copies. Here are the steps I followed to resolve this issue.
1. Export their contacts in the users Outlook to a CSV. In my scenario, the outlook session was locking up so I exported the PST out via Exchange Shell and then re-exported to a CSV out of Outlook. (New-MailboxExportRequest mailbox -IncludeFolders "#Contacts#" -ExcludeDumpster -FilePath \\server\share$\contacts.pst -name mailbox -acceptlargedataloss -baditemlimit 999)
Outlook 2013: File-->Open&Export-->Import/Export-->Export to a File-->Comma Separated Values-->Select Contacts Folder-->Save Exported File to location --> Click Finish.
2. Open Powershell, and Import the CSV created in step 1 into a Variable.
$File = Import-CSV "C:\users\username\desktop\userscontacts.csv"
3. Select the unique values for the $File, compares all columns.
$uniq = $File | Select * -unique
4. Export the unique values to a .csv file
$uniq | Export-csv "C:\users\username\desktop\userscontacts_unique.csv"
5. Delete the existing contacts in the users mailbox via Exchange Shell. The Search-Mailbox has a 10,000 item limit. I put the command in a loop so it continues to remove all contacts at 10,000 per loop cycle.
do {
Write-Host $i
Search-Mailbox mailbox -SearchQuery kind:contacts -DeleteContent -Force
$i++
}
while ($i -le 81)
6. Opened Outlook 2013 and followed similar steps as step 1, except I performed the import on the unique CSV. Note, I did have to clean up the CSV by removing the very first line as the very first line was not the column names. In order for the CSV import to work, the first line needs to be the column names and NOT the other junk that export may have carried over.
Now the unique contacts are restored.
1. Export their contacts in the users Outlook to a CSV. In my scenario, the outlook session was locking up so I exported the PST out via Exchange Shell and then re-exported to a CSV out of Outlook. (New-MailboxExportRequest mailbox -IncludeFolders "#Contacts#" -ExcludeDumpster -FilePath \\server\share$\contacts.pst -name mailbox -acceptlargedataloss -baditemlimit 999)
Outlook 2013: File-->Open&Export-->Import/Export-->Export to a File-->Comma Separated Values-->Select Contacts Folder-->Save Exported File to location --> Click Finish.
2. Open Powershell, and Import the CSV created in step 1 into a Variable.
$File = Import-CSV "C:\users\username\desktop\userscontacts.csv"
3. Select the unique values for the $File, compares all columns.
$uniq = $File | Select * -unique
4. Export the unique values to a .csv file
$uniq | Export-csv "C:\users\username\desktop\userscontacts_unique.csv"
5. Delete the existing contacts in the users mailbox via Exchange Shell. The Search-Mailbox has a 10,000 item limit. I put the command in a loop so it continues to remove all contacts at 10,000 per loop cycle.
do {
Write-Host $i
Search-Mailbox mailbox -SearchQuery kind:contacts -DeleteContent -Force
$i++
}
while ($i -le 81)
Now the unique contacts are restored.
Labels:
Exchange 2010,
Exchange 2013,
Outlook 2013,
Powershell
Thursday, May 8, 2014
Find a Message in the message tracking log against every transport server in your Exchange Org
The Powershell one liner below will search the Message Tracking Log against every transport server in your Exchange Organization. Note that you may want to change the Select statement to include/remove which values you want to pull back into view (you can replace with the entire Select statement with FL to see every value available).
Get-TransportServer | Get-MessageTrackingLog -Sender:user@domain.com -Recipients user@domain.com -MessageSubject "another test" -Start 5/8/2014 | Sort Timestamp | Select TimeStamp, EventID, Source, MessageSubject, ClientIP, ClientHostname, ServerIP, ServerHostname
Get-TransportServer | Get-MessageTrackingLog -Sender:user@domain.com -Recipients user@domain.com -MessageSubject "another test" -Start 5/8/2014 | Sort Timestamp | Select TimeStamp, EventID, Source, MessageSubject, ClientIP, ClientHostname, ServerIP, ServerHostname
Labels:
Exchange 2010,
Exchange 2013,
Powershell
Wednesday, May 7, 2014
Restart a Service Remotely through PowerShell
The PowerShell command below will restart a service remotely on another computer\server.
Restart-Service -InputObject $(Get-service -ComputerName ExMbx1 -name msexchangetransport)
Restart-Service -InputObject $(Get-service -ComputerName ExMbx1 -name msexchangetransport)
Tuesday, May 6, 2014
How to install the latest applicable updates for Microsoft Outlook
The article in the link below describes how to check to see if your Outlook is up to date and provides useful information about how to find your Outlook version and other important update information.
http://support.microsoft.com/kb/2625547
Labels:
Outlook 2003,
Outlook 2007,
Outlook 2010,
Outlook 2013
Thursday, May 1, 2014
Re-Enabling PST functionality in your Outlook session.
Scenario: You cannot open or create a PST within your Outlook. The options are missing OR it does not allow to complete a PST operation. If you try to Integrate SharePoint with your Outlook, you may receive the following error:
Outlook cannot add the folder because creating a new Outlook data file (.pst) file isn't allowed on this computer.
Solution: The registry has a DisablePST value that is set to not allow PST functionality. The data for this key is:
0 = Enables PST functionality
1 = Disable PST Functionality Completely
2 = Disables creating PST's, but allows to open PST's.
1. Open up the registry (regedit).
2. Click on Edit-Find and type in DisablePST. Perform a find. Keep hitting F3 to perform a 'find next' if this doesn't take you directly to the key.
3. Delete the Key or Set it to the corresponding value. Deleting the key or giving it a 0 are one in the same.
Searching it take you to a location similar to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\<version>\Outlook. This location may be different if using a 64 bit version of Outlook.
Outlook cannot add the folder because creating a new Outlook data file (.pst) file isn't allowed on this computer.
Solution: The registry has a DisablePST value that is set to not allow PST functionality. The data for this key is:
0 = Enables PST functionality
1 = Disable PST Functionality Completely
2 = Disables creating PST's, but allows to open PST's.
1. Open up the registry (regedit).
2. Click on Edit-Find and type in DisablePST. Perform a find. Keep hitting F3 to perform a 'find next' if this doesn't take you directly to the key.
3. Delete the Key or Set it to the corresponding value. Deleting the key or giving it a 0 are one in the same.
Searching it take you to a location similar to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\<version>\Outlook. This location may be different if using a 64 bit version of Outlook.
Labels:
Outlook 2007,
Outlook 2010,
Outlook 2013
Subscribe to:
Posts (Atom)