Closed
Description
A double-quote is missing from the end of the PSAppDeployToolkit-ExecuteAsUser.vbs which results in error: "Unterminated string constant". The fix is to add a double-quote to the end of the vbscript (i.e. ; Exit $LastExitCode }"). My PSAppDeployToolkit code is as follows:
Execute-ProcessAsUser -Path "$PSHOME\powershell.exe" -Parameters "-Command & { & `"C:\Temp\Script.ps1`"; Exit `$LastExitCode }" -Wait
The resulting PSAppDeployToolkit-ExecuteAsUser.vbs is as follows:
strCommand = chr(34) & "C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" & chr(34) & " -Command & { & " & chr(34) & "C:\Temp\Script.ps1" & chr(34) & "; Exit $LastExitCode }
set oWShell = CreateObject("WScript.Shell")
intReturn = oWShell.Run(strCommand, 0, true)
WScript.Quit intReturn