Scripting an AP reboot via SSH / CLI
We are experiencing an issue with the current AP330 firmware where the APs appear to stop passing traffic after a while (as in weeks of uptime as opposed to hours or days). Our solution thus far has been to log into WG cloud and reboot them, but since I have over 100 of them that needed rebooted, I decided I'd like to just build a script, add to Windows Task Scheduler, and have them rebooted once a week since WG does not provide a provision to do a scheduled reboot. I've tried a couple of different things including plink and posh-ssh. In both cases, once the script is connected and issues the "reboot" command, I get an error back that says "Not support for admin account." (this is not a typo on my part, that is the actual output).
Using plink, this is the command that should work:
"C:\Program Files\PuTTY\Plink.exe" -v -ssh 192.168.145.229 -l admin -pw "clear_text_pass" -batch reboot
Using Posh-SSH, it should be this:
$User = "admin" $PWord = ConvertTo-SecureString -String "clear_text_pass" -AsPlainText -Force $UserCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $PWord New-SSHSession -ComputerName 192.168.145.229 -Credential $UserCredential -Verbose Invoke-SSHCommand -SessionId 0 reboot Remove-SSHSession -SessionId 0
But neither work and exit with "Not support for admin account."
Has anyone been successful yet in scripting a reboot?
dcc
Comments
Hi @dcolpitts
There is a feature request to allow scheduled/recurring reboots via WatchGuard Cloud -- that is feature request AP-1277.
If you'd like to follow this request so that you're updated of any changes or a release, please create a support case and mention AP-1277.
-James Carson
WatchGuard Customer Support