Powershell: Write-Host throws an error
See original GitHub issueIf I do this: Write-Host "hello"
, I get this error:
Write-Host : A command that prompts the user failed because the host program or the command type does not support user interaction. Try a host program that supports user interaction, such as the Windows PowerShell Console or Windows PowerShell ISE, and remove prompt-related commands from command types that do not support user interaction, such as Windows PowerShell workflows. at run.ps1: line 1
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
Write-Error (Microsoft.PowerShell.Utility)
The Write-Error cmdlet declares a non-terminating error. By default, errors are sent in the error stream to the host program to be displayed, ......
Read more >Powershell Write-Output of array goes missing if error ...
Right so in Powershell if you Write-Output some lines and then throw an error, you'd expect to get the output that happens before...
Read more >PowerShell Errors and Exceptions Handling
Learn how to handle PowerShell Errors and Exceptions. Explore PowerShell's non-terminating vs terminating behavior. Explore rich PowerShell error objects.
Read more >PowerShell Write-Error Without Writing Stack Trace
Solution. To resolve the problem I wrote a Write-ErrorMessage function. The essence of the function was to write out the error message using...
Read more >steps/docs/powershell/using-write-error-vs-throw.md at ...
There are two basic methods in PowerShell to generate an error: Write-Error generates a non-terminating error (unless you set $ErrorActionPreference = 'Stop' , ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@johnnliu, yes we will provide a more comprehensive set of documentation soon. Thank you for your patience.
Yes, you will not be able to use Write-Host as Functions operate in a multi-tenant environment and PowerShell commands will not be able to interact directly with the host. Use Write-Output instead.