title: A positional parameter cannot be found that accepts argument System.Data.SqlClient.SqlDataReader
body: <p>I'm attempting to author a PowerShell script that simply executes a stored proc from my administration database but am running into this:</p>
  
  <pre><code>New-Object : A positional parameter cannot be found that accepts argument 'System.Data.SqlClient.SqlDataReader'.
  At C:\Scripts\Deployment\SPROCTest.ps1:19 char:15
  +     $reader = New-Object -TypeName System.Data.SqlClient.SqlDataReader  = $GetEn ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo          : InvalidArgument: (:) [New-Object], ParameterBindingException
  + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
  </code></pre>
  
  <p>Code would seem to be pretty straight forward like this:</p>
  
  <pre><code>$connection = New-Object -TypeName System.Data.SqlClient.SqlConnection
  $connection.ConnectionString = "Server=bhbrf95xva.database.windows.net;Database=MY.DATABASE;Integrated Security=False;User=theuser;Password=xxx^xxx"
  $connection.Open()
  
  $GetEnvironment = New-Object System.Data.SqlClient.SqlCommand
  $GetEnvironment.CommandText = "Select_Environment_ByEnvironmentName"
  $GetEnvironment.CommandType = [System.Data.CommandType]::StoredProcedure
  $GetEnvironment.Connection = $connection
  
  $ParamGetEnvironment = New-Object -TypeName System.Data.SqlClient.SqlParameter
  $ParamGetEnvironment.ParameterName = "@EnvironmentName"
  $ParamGetEnvironment.SqlDbType = [System.Data.SqlDbType]::VarChar
  $ParamGetEnvironment.Direction = [System.Data.ParameterDirection]::Input
  $ParamGetEnvironment.Value = 'TheValue'
  
  $GetEnvironment.Parameters.Add($ParamGetEnvironment)
  
  
  $reader = New-Object -TypeName System.Data.SqlClient.SqlDataReader  = $GetEnvironment.ExecuteReader()
  
  $connection.Close()
  </code></pre>
  
  <p>I'm not too concerned (yet) with the actual format of this script, I'm just trying to get it to work first, but I'm wondering why and how I get this to recognize <code>System.Data.SqlClient.SqlDataReader</code>?</p>
  
  <p>Do I need to add a plugin? </p>