Powershell PSCX ado sample

$Provider=”System.Data.SQLClient”
$ConnectionString=”Data Source=.;Initial Catalog=Northwind;Integrated Security=SSPI”
$Connection = Get-AdoConnection $Provider $ConnectionString
$Query = “SELECT * FROM Orders”

Invoke-AdoCommand -ProviderName $Provider -Connection $Connection -CommandText $Query

$Connection.Close()

Leave a comment