Have a question on how to pipe/use variable in Invoke-Sqlcmd -ServerInstance.
I can retrieve SQLServer Instance as System.Strings but can not pipe to the command.
You'll need to use subexpression operators to get the behavior you're after:
Invoke-Sqlcmd -ServerInstance "$($a.SqlServerName)\$($b.SQLInstanceName)" -Query "SELECT @@VERSION"
You must be logged in to reply to this topic.