0 votes


I am using a custom task to run PowerShell scripts that migrate users to Office 365. After the initial migration is complete, I'm running a second script asynchronously that monitors the progress of the migration then triggers another task when the migration is complete.

The scripts are timing out and getting "the pipline has been stopped" errors after 10 minutes, even though I have modified the timeout setting (Change softerra.adaxes.service.exe.config file and set maxCommandExecutionTimeSec=”900”) as described here: Exchange 2007 move mailbox fails.

Why is this setting not working? Has something changed?

Event log entry:
Softerra.Adaxes.CommandPipeline.CommandProcessingException: The following command threw an exception while being executed: Run PowerShell script 'check status of move' for 'O365Test, T1 (westfarm.com\Darigold Users\Adaxes_Test)'. ---> System.Management.Automation.PipelineStoppedException: The pipeline has been stopped.
at #2i.#1i.#i.#4i.#81(String script, String scriptName)
at #2i.#1i.#i.#4i.#71(String script, String scriptName, ExecuteScriptContextBase context)
at Softerra.Adaxes.Adsi.AdmObject.RunScript(ADM_SCRIPTTYPE_ENUM type, String scriptText, String scriptDescription, String principal, String password, Guid commandId, IAdmAction contextAction)
at Softerra.Adaxes.CommandPipeline.Actions.RunScriptAction.ExecuteAction(IAdmTop targetObject)
at Softerra.Adaxes.CommandPipeline.Actions.ActionBase.Execute(IAdmTop targetObjectArg)
at Softerra.Adaxes.CommandPipeline.Actions.RunScriptAction.Execute(ICommand command)
--- End of inner exception stack trace ---

by (710 points)

I've found a workaround, I'm looping through the command and after 7.5 minutes, terminating it and starting over.

It would be nice to have a setting when running a script, Timeout value. Set the default to 10 minutes fine... but let us on a per script/action basis set a custom timeout where needed.


1 Answer

0 votes
by (216k points)
selected by
Best answer


Since we provide the possibility to run custom scripts by Adaxes, we also need to provide a possibility to safely terminate an operation in case if something goes wrong, for example, if a user-developed script creates infinite loops, does not release resources etc. The 10-minute limit was made as a precaution to avoid such problems with user-developed scripts.

Currently, this behavior cannot be changed, however, there are 2 ways how you can work around the issue:

  • Optimize your script
    Check whether your script makes unnecessary calls, multiple calls to the same AD object etc. Try to avoid any excess calls as much as possible. Proceeding from our experience, sometimes, a well-optimized script can perform 20 times better than a non-optimized one. If you want, you can send you script to us or post it here for our script guys to have a look.

  • Run the script in a separate PowerShell instance
    If you feel that your script is well-optimized and, nevertheless, doesn't fit within the 10-minute limit, you can run it in a separate PowerShell instance. In this case, since the instance is not be initialized by Adaxes, the 10-minute limit does not apply, However, there is a drawback in this method: you won't be able to update Adaxes logs from this separate PowerShell instance. This means that if something happens while the script runs, such as an error or a warning, you won't be able to see it in Adaxes. If you want to follow this path, here's a short sample for you. The script that will be executed by a separate PowerShell instance is specified by ​$scriptBlockToExecute​.

      # Script block
      $scriptBlockToExecute = @"
      & {
          Copy-Item -Recurse -Path '%homeDirectory%' -Destination '\\server\share\%username%' -Force
          Remove-Item -Recurse '%homeDirectory%' -Force
      # Start Windows PowerShell as a separate process and run the script block in that process
      $arguments = @("-noninteractive", "-noprofile", "-executionpolicy bypass", "-Command $scriptBlockToExecute")
      $powershellPath = "$env:windir\syswow64\windowspowershell\v1.0\powershell.exe"   
      $starProcessInfo = New-Object System.Diagnostics.ProcessStartInfo
      $starProcessInfo.FileName = $powershellPath
      $starProcessInfo.Arguments = $arguments
      $starProcessInfo.WindowStyle = "Hidden"
      $starProcessInfo.CreateNoWindow = $True
      $process = [System.Diagnostics.Process]::Start($starProcessInfo)

Related questions

0 votes
1 answer

Hello, We have a problem with the way Adaxes detects % as variables in all PowerShell scripts. We are configuring a HTML email template for all out going emails from the system ... this is a start of a variable. Is there anyway around this? Regards, ice-dog

asked Feb 22, 2019 by ice-dog (170 points)
0 votes
1 answer

Hello, I have few business rules for AD account rename to validate input data and make sure username selected is unique in AD, but sometimes it fails with very non-explaining error " ... a "Before updating a User" rule BR14 - is a "Before renaming a User" rule

asked May 14, 2018 by DLe (760 points)
0 votes
1 answer

Hello Is it possible to reference a powershell script placed in a folder somewhere on the Adaxes server, instead of embedding them in each BR and CC ? I'm planning to install a powershell GUI product, for easy debugging. - Thanks

asked Feb 17, 2016 by Boxx.dk (2.6k points)
0 votes
1 answer

Hello! We're using Duo for MFA on Windows 10 logins and understand this creates a new credential provider in Windows along side Adaxes' Password Self Service (PSS) credential ... 2FA with a Auth app or SMS code along with questions/answers. Thank you, Kyle

asked Feb 8, 2022 by KyleCascade (20 points)
0 votes
1 answer

Hello, we have a forest with two trees that hold one domain each. There is a default tree-root trust (transitive, two-way) between the top domains. Since both trees are in ... Sid S-1-5-10 were found". Any help would be appreciated, thank you! Regards HarryNew

asked Oct 8, 2020 by HarryNew (270 points)
3,071 questions
2,784 answers
436,680 users