Script Repository


Delete all user data from mobile devices

February 18, 2021
1738

The script deletes all user data from all Exchange ActiveSync devices that belong to the user.

To use the script with Adaxes, you will need to create custom commands executed on User objects.

For more information on creating custom commands, see Create a Custom Command.

Parameters:

  • $exchangeServer - Specifies the fully qualified domain name or IP address of your Exchange Server.
Edit Remove
PowerShell
$exchangeServer = "Exchangeserver.domain.com" # TODO: Modify me

try
{
    $session = New-PSSession -connectionURI "http://$exchangeServer/powershell" -ConfigurationName Microsoft.Exchange
    Import-PSSession -session $session -AllowClobber -DisableNameChecking

    $Target = "%username%"
    Get-ActiveSyncDeviceStatistics -Mailbox $Target | foreach { Clear-ActiveSyncDevice $_.Identity }
}
finally
{
    Remove-PSSession -Session $session
}

Comments ( 0 )
No results found.
Leave a comment