Script Repository

Wipe all mobile devices

February 25, 2021

The script wipes all mobile devices of the target mailbox. The script can be executed in a custom command, business rule or scheduled task.

Edit Remove
# Get mailbox parameters
$mailboxParams = $Context.TargetObject.GetMailParameters("ADM_GET_EXCHANGE_PARAMS_FLAGS_NONE")

# Get active sync feature
$activeSync = $mailboxParams.MailboxFeatures.GetItemByType("ADM_EXCHANGE_MAILBOXFEATURETYPE_ACTIVESYNC")

# Wipe all mobile devices
foreach ($mobileDevice in $activeSync.MobileDevices)

# Save changes
$Context.TargetObject.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

Comments ( 4 )
Jan 27, 2021
Wil this wipe the complete mobile device or only the corporate data?

Thnx Remco
Jan 28, 2021
Hello Remco,

To perform the wipe, Adaxes uses the Clear-MobileDevice cmdlet which deletes all data from a mobile phone. For more details about the cmdlet, have a look at the following Microsoft article:
Remco Tiel
Jan 28, 2021
The clear-mobiledevice has a switch -accountonly. How to add this switch to the above script? I do not want to wipe the complete device.

Thnx remco
Jan 29, 2021
Hello Remco,

It can only be done by using the Clear-MobileDevice cmdlet itself in the script. For information on how to connect to Exchange in PowerShell scripts executed in Adaxes, have a look at the following article in our repository:
Leave a comment