I’ve tried following some of the other posts regarding this request, and I keep getting error messages with my install task string. The latest error was regarding an invalid character. Unfortunately the image failed to upload, so I have to type it out:
Error Record
Message : Exception calling “IsPathRooted” with “1” argument(s): “illegal characters in path.”
I do have my scripts in the root of the Files directory. And this is the install task command I’m using:
Start-ADTProcess “$PSHOME\powershell.exe” -FilePath `ODKFMv2.ps1`
Any help would be much appreciated. Thank you
Alas too many things have been fixed in PSADT v4.1.
The first thing you should do is upgrade to v4.1
I can’t see any reason why this’d be occurring, but you’ve not provided any logs or much other context, etc. The reason the logger prints stack traces and other good stuff is so we can see more about your world. The error message on its own doesn’t mean a lot.
Lastly, why run a new PowerShell script in a new PowerShell process like this? You’d be better off using the call operator (&) to invoke the script, then you can try/catch it like any other function, etc. Better yet, rewriting it into something directly within Invoke-AppDeployToolkit.ps1 would yield the best result.
We should add sample code like this in the docs.
Try {
$PathToPs1File = "$($adtSession.DirFiles)\ODKFMv2.ps1"
&$PathToPs1File
} Catch {
Invoke-ADTFunctionErrorHandler -Cmdlet 'MyStandAloneScript' -SessionState $ExecutionContext.SessionState -ErrorRecord $_ -LogMessage "The StandAloneScript failed to run"
}
I’ll set a reminder for myself.