I am extremely new to Powershell. I am trying to learn by writing an automation script that ssh
s into a device and runs some commands. Since the remote device is using Ubuntu 20 and I am not allowed to use ssh keys, I am having to implement expect
statements.
I have installed Cygwin to get access to the expect
command and ensured that the correct environment path has been added to my Windows laptop.
The problem is in this line of code:
$session = @"
spawn ssh -tt $user@$ip_address
expect {
-re ".*password: " {
send "$pword\r"
}
}
"@
The error that I am receiving looks like it shows a s"
in the output:
extra characters after the close-brace
while executing
"expect {
-re ".*password: " {
send "$pword\r"
}
}s"
Is there a reason why that s"
is showing up? Is that what is causing my issues?
Thank you for the help!