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.
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
}
Couldn't find '{USERNAME}' as a recipient. Stack trace: at <ScriptBlock><Process>, <No file>: line 44
Where USERNAME is the username of the account. i tried changing the Username value to UPN and Email attributes. neither option seems to make a difference. Any ideas?
The error is not related to the script or Adaxes. It is returned by the Get-ActiveSyncDeviceStatistics cmdlet as it cannot find the account. Such a behaviour can occur if you delete the user somewhere in your script before running the cmdlet.