Skip navigation

How do I solve Write-Host failures in DSC?

Q. I have a PowerShell script that uses Write-Host but it causes it to fail in certain scenarios including using DSC, what can I do?

A. The easiest way to handle scripts that call Write-Host is to replace the Write-Host with Write-Verbose. A very way to solve this outside of changing the actual script/module is to create an alias which changes Write-Host to Write-Verbose! For example:

New-Alias Write-Host Write-Verbose

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish