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.
Parameters:
- $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.
PowerShell
# Declare script to move home folders
$scriptBlockToExecute = {
$sourcePath = '%homeDirectory%' # TODO: modify me
$destinationPath = '\\server\share\%username%' # TODO: modify me
try
{
Copy-Item -Recurse -Path "$sourcePath" -Destination "$destinationPath" -Force -ErrorAction Stop
}
catch
{
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)
Unfortunately, there is no such possibility.