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 (780 points)

1 Answer

0 votes
by (216k 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

Hello, I am trying to do as best as I can researching the best and effective way to manage the properties of Office 365 Exchange Properties with Adaxes (Latest Version) ... sure if there is a command or config I missed for adjusting the Distribution Lists.

asked Dec 19, 2023 by Edogstraus00 (470 points)
0 votes
1 answer

When trying to set "Accept Messages" to "All senders" on distribution group through Adaxes web interface I get error: Adaxes doesn't have any permissions to ... of mentioned role? I tried give it msExchRequireAuthToSendTo permission but that didn't help.

asked Dec 1, 2022 by KIT (910 points)
0 votes
1 answer

When creating a hybrid user mailbox with a Business Rule, after user creation, the remote routing address of the mailbox is set to the users email alias. How do I set it to the 365 address username@ourdomain.mail.onmicrosoft.com

asked Apr 13, 2022 by john.harding (70 points)
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 (910 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 (240 points)
3,315 questions
3,013 answers
7,703 comments
544,554 users