I am trying to call a powershell script from HTML Application [HTA] as :
Set WshShell = CreateObject(\"WScript.Shell\")
Set retVal = WshShell.Exec(\"powersh
You can use the Exec method of WScript.Shell to avoid intermediate files. Unfortunately it opens a new window when it runs, but the code is much cleaner and gives you access to the StdOut and StdErr streams. Paste this into an .HTA file (with header and body if desired) to test:
Part of your problem may have been that Exec isn't blocking waiting for StdOut to start filling up. Adding the timer corrected that issue for me.