title: Powershell - Custom enum as a parameter for a script
body: <p>I have a script with a set of functions and instructions and declared enumeration:</p>
  
  <pre class="lang-bsh prettyprint-override"><code>Add-Type -TypeDefinition @"
      public enum CleanUpPolicy {
          NoCleanUp,
          CleanUpByExpiration,
          CleanUpByMaxCount
      }
  "@
  </code></pre>
  
  <p>and a script parameters with this enum like:</p>
  
  <pre class="lang-bsh prettyprint-override"><code>param (
      [CleanUpPolicy] $cleanUp = [CleanUpPolicy]::NoCleanUp
  )
  </code></pre>
  
  <p>The script works fine when I run it locally. However this script should be downloaded and executed on remote machine and here come issues. 
  When I'm doing downloading and execution, I got an error <strong>iex : Unable to find type [CleanUpPolicy]</strong>
  Here is script which downloads and executes the script:</p>
  
  <pre class="lang-bsh prettyprint-override"><code>iwr ("https://&lt;some_url&gt;/test.ps1") | iex
  </code></pre>
  
  <p>What I'm doing wrong? 
  Thanks in advance for your help</p>