I am simply trying to get a success or failure code out of a PowerShell script when run via VBScript with CreateObject("WScript.Shell").Run(strCMD, 0, True).
I thought Exit produced an exit code, but when I end my PS script with Exit 9 the value returned to the VBScript above is still 0.
The VBScript is:
strCmd = "powershell.exe -noLogo -executionpolicy bypass -file ""\\Mac\Px\Support\Px Tools\Dev 3.3.#\_Spikes\TestMessage.ps1"" -message:""I'm ALIVE"""
result = CreateObject("WScript.Shell").Run(strCMD, 0, True)
msgBox result