1

I have a powershell command that I am trying to invoke on a remote vm. I have it working with a switch but when I try passing in string variables these params never make it to the script thats being executed.

Invoke-Command -ComputerName $ComputerName -Credential $cred -ScriptBlock {param([bool]$CollectLocally,[string]$SqlLogin,[string]$SqlPassword) C:\DiagnosticsCollection_BRB.ps1 -CollectLocally:$true -SqlLogin:$SqlLogin -SqlPassword:$SqlPassword}

Thats the line that I have, the switch -CollectLocally works as expected, but my sqllogin and password never make it, but if I use something like "login" "password" instead of variables then those make it to the script on the remote vm. What am I missing here?

Darth Scitus
  • 490
  • 1
  • 9
  • 21

0 Answers0