We use cookies to improve your experience.
By your continued use of this site you accept such use.
For more details please see our privacy policy and cookies policy.

Script repository

Wipe all mobile devices

February 25, 2021 Views: 1390

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
PowerShell
# 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)
{
    $mobileDevice.WipeStatus = "ADM_MOBILE_DEVICE_WIPE_STATUS_WIPEPENDING"
}

# Save changes
$Context.TargetObject.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")
Comments 6
avatar
Remco Jan 27, 2021
Wil this wipe the complete mobile device or only the corporate data?

Thnx Remco
avatar
Support 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: https://docs.microsoft.com/en-us/powershell/module/exchange/clear-mobiledevice?view=exchange-ps.
avatar
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
avatar
Support 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: https://www.adaxes.com/script-repository/connect-to-exchange-with-powershell-s506.htm.
avatar
JPWGC Dec 19, 2022
Does the new version of Adaxes allow for an -accountonly wipe natively without having to call the clear-mobiledevice cmdlet manually by chance?
avatar
Support Dec 20, 2022
Hello,

Unfortunately, there is still no such possibility. It can only be done by directly using the Clear-MobileDevice cmdlet.
Leave a comment
Loading...

Got questions?

Support Questions & Answers