title: Why does accessing a parameter variable's attributes with Get-Variable only work the first time in the ISE?
body: <p>Thanks to the great people at StackOverflow we received a very good <a href="https://stackoverflow.com/questions/42697072/find-the-values-in-validateset/42697469?noredirect=1#comment72520630_42697469">answer</a> on how to retrieve the values defined in <code>ValidateSet</code> within the <code>Param()</code> clause of a script or function:</p>
  
  <pre><code>Param (
      [ValidateSet('Startup', 'Shutdown', 'LogOn', 'LogOff')]
      [String]$Type = 'Startup'
  )
  
  (Get-Variable Type).Attributes.ValidValues
  </code></pre>
  
  <p>The only thing that bothers me is that this code only works the <strong>first time</strong> when you run it in the PowerShell ISE. The <strong>second time</strong> you run it, there is no output generated. </p>
  
  <p>Is there a workaround to have it always working? We use PowerShell 4.0 on Win 7 and Win 2012.</p>