title: Decode Base64 String in Powershell
body: <p>I have a Base64 encoded file and I am trying the following to decode it:</p>
  
  <pre><code>[System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($data)) 
  </code></pre>
  
  <p>However it generates the following error:</p>
  
  <pre><code>Exception calling "FromBase64String" with "1" argument(s): "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding 
  characters, or an illegal character among the padding characters.
  </code></pre>
  
  <p>Although it is Base64, completely. Any ideas?</p>
  
  <p>*Please note that it is Base64, but not encoded by PowerShell.</p>