invoke-sqlcmd server with port.

  • I have a server list to include a few servers with a non-standard port.

    individually:

    invoke-sqlcmd -ServerInstance server01 ... is fine.

    invoke-sqlcmd -ServerInstance "server\instance,1488" ... is fine.

    invoke-sqlcmd -ServerInstance server\instance,1488 ... fails.

    I need the quotes where I have to provide a non standard port.

     

    But, I have a powershell that runs gc against a serverList, puts each server into $a then runs SQL against each server via invoke-sqlcmd.

    I can't figure out how to pull from my serverList, and put the quotes around the  server variables "server\instance,1488"

     

    Please help.  This is doing my head in!!

     

     

    • This topic was modified 2 years, 5 months ago by  snomadj.
  • invoke... "$($servervariablefromlist)"

  • This was removed by the editor as SPAM

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply