SSH Script Execution in Windows Batch
Posted on 2016-08-26
I have a HPE M330 OfficeConnect 802.11ac access point. It needs to be rebooted periodically in order to run well.
The easiest way to reboot the AP is to SSH in and issue the 'reboot' command.
I am able to connect via plink.exe to reach the shell and manually enter reboot, but when I try to pull the command from a text file, I get an error ": cannot open" Ultimately, I want to create a batch file and run it as a scheduled task.
Here's the command line:
plink -ssh email@example.com -pw xxxxxxx -m reboot.txt -v
reboot.txt contains reboot on a single line with a return at the end (created in notepad).
Here is the verbose output of the plink command line. I'd appreciate any assistance.
C:\Utility>plink -ssh firstname.lastname@example.org -pw xxxxxxx -m reboot.txt -v
Looking up host "10.2.1.2"
Connecting to 10.2.1.2 port 22
Server version: SSH-2.0-dropbear_0.51
We believe remote version has SSH-2 channel request bug
Using SSH protocol version 2
We claim version: SSH-2.0-PuTTY_Release_0.67
Using Diffie-Hellman with standard group "group1"
Doing Diffie-Hellman key exchange with hash SHA-1
Host key fingerprint is:
ssh-rsa 1040 68:fa:ef:f2:76:35:af:5f:27:a6:db:21:b8:84:bb:b2
Initialised AES-256 CBC client->server encryption
Initialised HMAC-SHA1 client->server MAC algorithm
Initialised AES-256 CBC server->client encryption
Initialised HMAC-SHA1 server->client MAC algorithm
Using username "admin".
Opening session as main channel
Opened main channel
Started a shell/command
: cannot open
Server sent command exit status 255
Disconnected: All channels closed