This is from within a custom task. Account has proper RBAC permissions and I can do this from a normal powershell window.

ago by (320 points)
ago by (308k points)
0

Hello,

What exactly do you mean by import remote Exchange? Please, describe the task you want to fulfill with the script in all the possible details with live examples. Also , please, provide a screenshot of the Multi-server environment dialog. The dialog displays how many Adaxes services you have and what their versions are. For information on how to view it, see https://www.adaxes.com/help/MultiServerEnvironment. You can post the screenshot here or email to support@adaxes.com.

ago by (320 points)
0

It's freezing up at the following. $connUri is a mail servers FQDN.

Write-Log "Connecting to Exchange: $connUri"
$sessionOpt = New-PSSessionOption -OpenTimeout 30000 -OperationTimeout 60000
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $connUri -Authentication Kerberos -SessionOption $sessionOpt -ErrorAction Stop

We have two servers running 3.16.21906 in separate AD sites.

1 Answer

ago by (308k points)
0 votes

Hello,

First of all, Write-Log does not work in Adaxes scripts. To make an output, use method $Context.LogMessage. As for connecting to an on-premises Exchange server, have a look at the example in the following article: https://scripts.adaxes.com/connect-to-exchange-with-powershell#exchange-on-premises. We also recommend you to check the following tutorial: https://www.adaxes.com/help/AutomateExchangeMailboxConfiguration. Most probably, the task you need to perform can be done using built-in functionality without using any scripts.

ago by (320 points)
0

That isn't very helpful as Im basically running the same code to ill effect. There's seemingly no way to create a Distribution List directly, only mail enabling an AD group which we're trying to avoid since failures leave a dangling group.

ago by (308k points)
0

Hello,

Do we understand correctly that using the code from the repository article produces an error? If that is correct, please, provide a screenshot.

Related questions

In this case the working example would be that the user would need to add a new title into a list of titles in the title property pattern

asked Dec 13, 2024 by msheppard (880 points)
0 votes
1 answer

Hi, is it possible to use custom Powershell script to determine, who will be able to modify AD object property (for example managedBy)? So it is not manager of given object who can edit this property, but anyone who pass checks in Powershell script..

asked Apr 7, 2020 by KIT (1.1k points)
0 votes
1 answer

I'm in the process of creating a Web interface for requesting IT accounts. Upon submission, I want to run a Powershell script that will create an item in a Sharepoint task list.

asked May 14, 2021 by sandramnc (870 points)
0 votes
1 answer

This is only to disable user account

asked Apr 18, 2025 by Erik Lovlie (20 points)
0 votes
1 answer

Let's say that I have a scheduled task that adds a high-level roles-based AD group to a user. As part of that same task, I'd like to run a powershell script to collect all ... the task to type in the "parent" group name, and pass it to the script that way?

asked Sep 22, 2025 by 3Jake (210 points)
0 votes
1 answer