question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Powershell: Write-Host throws an error

See original GitHub issue

If 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:closed
  • Created 7 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
tohlingcommented, Oct 27, 2016

@johnnliu, yes we will provide a more comprehensive set of documentation soon. Thank you for your patience.

1reaction
tohlingcommented, Aug 19, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found