Hi all!
Have a question on how to pipe/use variable in Invoke-Sqlcmd -ServerInstance.
Usecase: working on script which runs some SQL code for SQLServer\Instance, but they are different most of the time.
I can retrieve SQLServer Instance as System.Strings but can not pipe to the command.
Set-location sqlserver:\sql\ doesn’t accept variables too
Invoke-Sqlcmd -ServerInstance $a.SqlServerName$b.SQLInstanceName -Query “SELECT @@VERSION”