Hello,
Currently, Adaxes Exchange API does not support adding device IDs to the block list in Exchange ActiveSync, but you can use PowerShell cmdlets for this purpose.
To call Exchange PowerShell cmdlets in PowerShell scripts used by Business Rules, Custom Commands or Scheduled Tasks, you need to create a remote PowerShell session to your Exchange server, for example:
$exchangeServer = "exchangeServer.domain.com" # TODO: Modify me
$session = new-pssession -connectionURI "http://$exchangeServer/powershell" -ConfigurationName Microsoft.Exchange
Import-PSSession -session $session
# TODO : Some code to be executed on the Exchange Server here
Remove-PSSession -Session $session
In the script, $exchangeServer specifies the Fully Qualified Domain Name (FQDN) of your Exchange Server. Making a Remove-PSSession at the end is important to free up resources.
So, in your particular case, the code will be as follows:
$exchangeServer = "exchangeServer.domain.com" # TODO: Modify me
$session = new-pssession -connectionURI "http://$exchangeServer/powershell" -ConfigurationName Microsoft.Exchange
Import-PSSession -session $session
$DeviceIDs = Get-ActiveSyncDeviceStatistics -Mailbox $user | select -ExpandProperty DeviceID
Set-CasMailbox -identity $user -ActiveSyncBlockedDeviceIDs $DeviceIDs
Remove-PSSession -Session $session