We use cookies to improve your experience.
By your continued use of this site you accept such use.
For more details please see our privacy policy and cookies policy.

Script Repository

Move large home folders

February 18, 2021 Views: 2767

Use this script if you are getting The pipeline has been stopped errors when trying to move large home directories of users using the standard Move the home directory action. The script moves home directories in a separate PowerShell process, which eliminates the 10-minute limit applied by Adaxes to running a PowerShell script.


  • $sourcePath - Specifies an initial home directory path.
  • $destinationPath - Specifies the destination path where a home directory will be moved.
Note: You can use value references (e.g. %username%) as a part of the source and the destination paths.
Edit Remove
# Declare script to move home folders
$scriptBlockToExecute = {
    $sourcePath = '%homeDirectory%' # TODO: modify me
    $destinationPath = '\\server\share\%username%' # TODO: modify me
        Copy-Item -Recurse -Path "$sourcePath" -Destination "$destinationPath" -Force -ErrorAction Stop
        return # Exit script
    Remove-Item -Recurse "$sourcePath" -Force
# Start Windows PowerShell as a separate process to run the script
$arguments = @("-noninteractive", "-noprofile", "-executionpolicy bypass", "-Command " + $scriptBlockToExecute.ToString())
$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)
Comments 2
Grant Dec 06, 2023
Can this script be updated so that it will still output errors to the Adaxes log from the external Powershell process?
Support Dec 07, 2023
Hello Grant,

Unfortunately, there is no such possibility.
Leave a comment

Got questions?

Support Questions & Answers