SQLExample
suggest changeTo query every row from the table MachineName, use Invoke-Sqlcmd2 from the Invoke-Sqlcmd2 module. The built-in command is Invoke-Sqlcmd in the SqlServer module. A password on the command line is visible to other processes.
$Query = "Select * from MachineName"
$Inst = "ServerInstance"
$DbName = "DatabaseName"
$UID = "User ID"
$Password = "Password"
Invoke-Sqlcmd2 -ServerInstance $Inst -Database $DbName -Query $Query -Username $UID -Password $Password
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents