Wednesday, February 20, 2019

Powershell Ergebnis sql Abfrage anzeigen Out-Gridview

display sql return:


Write-Verbose $sql;

# if windows user has not enough rights use other eg.: -Username sa -Password xxx
$ret=invoke-sqlcmd  -Query $sql -serverinstance $ServerInstance -Database $Database 

#display in cmd window
write-host ($ret | Format-Table | Out-String)

#display in new window with columns
$Ret | Out-GridView


No comments: