title: How to convert a hash string to byte array in PowerShell?
body: <p>When my scripts run, I read a hash, and I would like to write it to the registry.
  I figured out that the following command will do it:</p>
  
  <pre><code>New-ItemProperty  $RegPath -Name $AttrName -PropertyType Binary -Value $byteArray
  </code></pre>
  
  <p>I also found the <a href="https://stackoverflow.com/q/6551224/1157814">How to set a binary registry value (REG_BINARY) with PowerShell?</a>.</p>
  
  <p>However all answers suppose that the string is in form of:</p>
  
  <pre><code>"50,33,01,00,00,00,00,00,...."
  </code></pre>
  
  <p>but I only can read my hash in the following form:</p>
  
  <pre><code>"F5442930B1778ED31A....."
  </code></pre>
  
  <p>I can not figure out, how can I convert this to a byte array, with values F5, 44 etc.</p>