Powershell script is always returning 0 via HTA
<p>I'm trying to get an output from the PowerShell script that I wrote.</p>

<p>test.ps1</p>

<pre class="lang-bsh prettyprint-override"><code>Get-Process
</code></pre>

<p>the VBScript in the HTA is coded as following:</p>

<pre class="lang-vb prettyprint-override"><code>Sub Test()  
    cmd = "powershell.exe -noprofile -command .\test.ps1; exit $LASTEXITCODE"
    Set shell = CreateObject("WScript.Shell")
    Set executor = shell.Exec(cmd)
    executor.StdIn.Close
    MsgBox executor.StdOut.ReadAll
End Sub
</code></pre>

<p>When I'm trying this <code>cmd</code> string in the command line it works perferctly. But the message box is always popping up with empty space.</p>

<p>What's the best way to fix this?</p>