Summary: Use the Format-Hex cmdlet to produce hexadecimal output.
How can I use Windows PowerShell to put data in a binary key in the registry?
In Windows PowerShell 5.0, you can use the Format-Hex cmdlet, for example:
‘This is meant to be binary’ | Format-Hex
$DataForRegistry=(‘This is meant to be binary’ | Format-Hex).Bytes