PowerShell Core does not have -Encoding Byte. Replaced with new parameter AsByteStream

Carrying out the following in Windows PowerShell worked, but didn’t always make a lot of sense because Byte is not really an Encoding type:

If you try to run the same command in PowerShell Core you will receive the following error:

Set-Content : Cannot bind parameter ‘Encoding’. Cannot convert the “Byte” value of type “System.String” to type “System.Text.Encoding”.

This is because Byte is no longer a valid selection for the Encoding parameter:

That’s because it has been replaced by a new parameter AsByteStream, which makes more sense for what you are typically actually trying to do.

Thanks to Mark Kraus for pointing this change out to me.

Leave a Reply

Your email address will not be published. Required fields are marked *