In a nutshell:
The correct cmdlet to use is Write-Output. Using Write-Output will display the results to the screen when you run you script by itself but, it will also allow your script to be used in a pipeline (or foreach loop) and have the results used by other scripts/cmdlets.
See also
Why I Use Write-Host In PowerShell
This article gives some of the benefits of using Write-Host cmdlet.
Keywords: powershell write-host write-output
No comments:
Post a Comment