The following code:
$values = Get-Content ./values.yaml
Write-Host $values
Gives the error:
Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Message'. Specified method is not supported.
Running Write-Host $values.ToString()
does not give an error, but it only outputs the text of "System.Object[]".
How can I use Write-Host to output the text of this file?
NOTE: I would also like to preserve the line endings in the file. (I just found that Write-Host "$values"
will give the text, but the line endings are gone.)
(Note, I really am going to be using Write-Verbose, but Write-Host is similar and easier to test and ask about.)