title: Set-Execution policy on remote computer using Variable
body: <p>I have a problem reverting back powershell execution policy on remote computer using variable. </p>
  
  <pre><code>$RestrykcjaNowa = 'Bypass'
  $RestrykcjaZastana = Invoke-Command -ComputerName $Komputer -ScriptBlock { Get-ExecutionPolicy }
  $RestrykcjaZastana
  Invoke-Command -ComputerName $Komputer -ScriptBlock { Set-ExecutionPolicy -ExecutionPolicy $RestrykcjaNowa -Scope LocalMachine -Force } | Out-Null
  </code></pre>
  
  <p>But I got an error </p>
  
  <blockquote>
    <p>Cannot bind argument to parameter 'ExecutionPolicy' because it is null</p>
  </blockquote>
  
  <p>When I replace variable <code>$RestrykcjaNowa</code> with value <em>Bypass</em> in last command it goes smoothly.</p>
  
  <p>I noticed that variable <code>$RestrykcjaZastana</code> is not displayed on the screen when called in 2nd line of the code and is of type <em>int</em> but i can't assign value <em>Bypass</em> to integer variable manually.</p>
  
  <p>What is wrong with my approach?</p>