title: Powershell - Array Range from user input
body: <p>What would be the easiest way to get user input for an array range.</p>
  
  <p>For example:</p>
  
  <pre><code>function MyArrayOfMachines {
  [CmdletBinding()]
  param(
      [parameter(Mandatory=$true)][string]$Machine
      # What should I assign the $Range variable as?
      )
   # Hardcoded range. User should be able to enter the range
   $Range = 2..5
   for ($i=0; $i -lt $array.length; $i +=1)
   {
     $result = $array[$i]
     $output = $machine+$result
     $output
   }
  }
  </code></pre>
  
  <p>The above function should take the input as the name of the machine and the array range. For now I have the array range hardcoded. When I assign $Range as [Array]$Range in the user prompt, there is a prompt for $Range[0] etc etc. But I would like the user the enter the range.</p>