0 votes

I've the following Exchange powershell code which put ActiveSync devices in a blocked list, how to convert this to Adaxes?

$DeviceIDs = Get-ActiveSyncDeviceStatistics -Mailbox $user | select -ExpandProperty DeviceID

Set-CasMailbox -identity $user -ActiveSyncBlockedDeviceIDs $DeviceIDs

b.t.w. Is it possible to call Exchange commands within Adaxes (e.g. import module?) so there's no need to convert scripts?

Thnx Remco

by (5.3k points)

1 Answer

0 votes
by (217k points)

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

Related questions

0 votes
1 answer

Hi, we need to create some form (or custom command?) so managers of distribution groups can add/remove/change alias address. Primary and secondary. Distribution groups are ... contains list of current aliases with possibility to edit them... Thank you Sebela

asked Nov 18, 2019 by KIT (3.1k points)
0 votes
1 answer

Bit confused here - yesterday I renamed a service account using Adaxes, nothing special just a normal domain account, no mailbox or Exchange attributes. Today I came to do some ... t see anything in the release notes. Any thoughts before I log it with Support?

asked Feb 15, 2014 by hutchingsp (1.9k points)
0 votes
1 answer

Hello Active Directory does not accept users with the same name, in the same OU. Surprisingly, in real life to employees may have the same name, like John Smith, in ... the "name" property, to overrule the limitation in Active Directory. - Thanks in advance

asked Oct 9, 2015 by Boxx.dk (11.9k points)
0 votes
1 answer

When administrator tries to add a person to a group the search bar "Look in" textbox defaults to the group container. Is there a way to set the "Look in" textbox to default to "Everywhere" instead of the group container?

asked Jul 24, 2015 by lgibbens (1.4k points)
0 votes
1 answer

Hallo, I'm trying to build a function that will have two parameters $Containrer and $Filter $filter - is a LDAP filer that serach some specific objects $Containrer - is a ... is treated by powershell as a hash table, is it possible to workoroud it somhow?

asked Aug 12, 2015 by axmaster (2.7k points)
2,352 questions
2,107 answers
5,746 comments
131,506 users