I have the following PowerShell script Job that uses a ScriptBlock. I am trying to use the variable $pw1
but it does not seem to be using it correctly. How can I use variables in a ScriptBlock or a string?
Start-Job -ScriptBlock {Start-Process "C:\Users\Mark\Desktop\putty.exe" -argumentlist "-ssh Mark@192.168.1.3 -pw $pw1 -m C:\Users\Mark\Desktop\commands.txt -t" -passthru -Wait ;cmd.exe /c start cmd /k PSlist}