I have tried a few different things like $PSScriptRoot but when running through SCCM it doesn’t install. I also tried running with start-process and the -argumentlist parameter but that also fails.
I’m not getting anything in the event log and the SCCM log says success (as the script is running)
The ampersand character is a “call operator” in PowerShell. See Call operator - Run - PowerShell - SS64.com. It tells the PowerShell engine to execute the string provided. Let me know if that fixes the issue. As you had the line written all it is doing is returning the string value as output.
The only other comment I have (from learning the hard way) is that $PSScriptRoot only exists in PowerShell 3 and above. If you’re managing SCCM clients that still only have PowerShell 2 you should default to using the method you are using to assign the $scriptPath variable on line #3.
The ‘&’ was indeed what I needed to get it to deploy. I should have passed it to get-member then I would have (hopefully) noticed that it was a string.