Sure, the script I was using is
Import-Module Adaxes
$TargetPath = "%adm-CustomAttributeText1%"
$Context.LogMessage("Target OU is $TargetPath", "Information")
try { Move-AmdObject -Identity "%objectGUID%" -TargetPath $TargetPath }
catch { $Context.LogMessage("Failed to move the user with error $Error[0]", "Error") }
Where %adm-CustomAttributeText1% has been set earlier in the process and the value is correct in the log file.
If I import the Adaxes module in Powershell directly and fudge the GUID to a non valid one, I get the error
Move-ADMObject : Can't find an object with identity 'invalid guid'.
At C:\\Users\\...\\Desktop\\TestUserMove.ps1:8 char:7
+ try { Move-ADMObject -Identity $testguid -TargetPath $Destination }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) \[Move-AdmObject\], IdentityResolvingException
+ FullyQualifiedErrorId : Softerra:Adaxes:PowerShellModule:Commands:MoveAdmObjectCommandExecutor:ProcessRecord:IdentityNotResolved,Softerra.Adaxes.PowerShell
Module.Commands.MoveAdmObjectCommand
The Catch statement is never executed.
Thanks