title: Powershell 2.0 - extract parameters from script block
body: <p>Is there a way to extract the parameter list of a script block from outside the script block in PS 2.0 ?</p>
  
  <p>Say we have</p>
  
  <pre><code>$scriptb = { PARAM($test) }
  </code></pre>
  
  <p>In Powershell 3.0 we can do this </p>
  
  <pre><code>$scriptb.Ast.ParamBlock.Parameters.Count == 1 #true
  </code></pre>
  
  <p>The Ast property however was included in powershel 3.0 so the above will not work in PS 2.0 <a href="https://msdn.microsoft.com/en-us/library/System.Management.Automation.ScriptBlock_properties%28v=vs.85%29.aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/System.Management.Automation.ScriptBlock_properties%28v=vs.85%29.aspx</a></p>
  
  <p>Do you know of a way to do this in PS 2.0 ?</p>