Hello all,
I'm delivering a packaged ps script (exe) to remote machines (software delivery application executing locally).
I can't seem to get the basic output to return to my delivery program console though.
It's a simple script in the package for this test:
Write-Host "Write-Host"
Write-Output "Write-Output"
Etc... for every Write-* option in PS.
Before packaging, Write-Output would return to my app console, but after packaging it's all blank.
I've tried package settings for PS V3 Silent & Command Line, but to no avail.
Any thoughts?
PowerShell Packaged to exe; Trouble with Write-Output
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: PowerShell Packaged to exe; Trouble with Write-Output
Tried v5 command line, still no output though.
Re: PowerShell Packaged to exe; Trouble with Write-Output
Put the following in a PS1 file and build with V5 (command line) and you will see the output.
Code: Select all
Write-Host "Write-Host"
Write-Output "Write-Output"
pause
Re: PowerShell Packaged to exe; Trouble with Write-Output
Maybe you missed it in my op, but I’m delivering with a software delivery program. I am able to get output from write-output and write-host if I send it as a ps1, but if sending an exec of it I get nothing back.
My test script is a simple one just to try to get output back to the software delivery programs console.
So not sure why output is not returning from the ps1 thru the exe back to the software delivery application console.
My test script is a simple one just to try to get output back to the software delivery programs console.
So not sure why output is not returning from the ps1 thru the exe back to the software delivery application console.
Re: PowerShell Packaged to exe; Trouble with Write-Output
Figured it out.
Was using {cmd/c start ps1.exe} which was spawning a new console and not preserving the output.
Now I used {cmd /c call ps1.exe} and it returned just fine.
So CALL vs START... (facepalm)
Thanks anyways for the assist.
Was using {cmd/c start ps1.exe} which was spawning a new console and not preserving the output.
Now I used {cmd /c call ps1.exe} and it returned just fine.
So CALL vs START... (facepalm)
Thanks anyways for the assist.
Re: PowerShell Packaged to exe; Trouble with Write-Output
You don't need any of that, Just execute the exe.
cmd /c ps1.exe
The same as any other exe that you run. There is also no need to use CMD. Just run the EXE. Use START when you want to execute the exe in anew process. Use CLL to call an external CMD/BAT file.
The best advice is to never use CMD as it is obsolete and will likely be removed in the next version of Windows. In Windows 10 and later PowerShell is the default console for Windows and CMD exists only for backwards compatibility. No new work should ever rely on CMD/BAT/CMD files.
cmd /c ps1.exe
The same as any other exe that you run. There is also no need to use CMD. Just run the EXE. Use START when you want to execute the exe in anew process. Use CLL to call an external CMD/BAT file.
The best advice is to never use CMD as it is obsolete and will likely be removed in the next version of Windows. In Windows 10 and later PowerShell is the default console for Windows and CMD exists only for backwards compatibility. No new work should ever rely on CMD/BAT/CMD files.