Using a specific script on ZyWALL USG via SSH

How can I send CLI commands to ZyWALL USG using a bat file in Windows?

Consider this problem by example. Suppose you send a crypto algorithm-hide to disable crypto command to the hardware gateway and reboot the device. Moreover, a set of commands and the IP address of the ZyWALL USG must be in separate files.

To solve this problem, we need:

  1. The plink utility (available for download from here).
  2. The IP.txt file contains the IP address of the ZyWALL USG (192.168.1.1 by default).
  3. A com.cli file containing the contents of the command set for the ZyWALL USG.
    In our example, it has the following form:
    configure terminal
    crypto algorithm-hide disable
    write
    reboot
    exit
  4. The run.bat file is as follows:
    @echo off 
    set login=admin
    set pw=1234
    set CLI_FILE=com.cli
    set REMOTE_LIST=IP.txt

    for /F "tokens=*" %%A in (%REMOTE_LIST%) do plink -ssh -pw %pw% -no-antispoof %login%@%%A < %CLI_FILE%
    set login=admin - the variable where username is stored ( admin is the default)
    set password=1234 - variable where the password from ZyWALL is stored ( 1234 by default)
    All files must be in the same folder. As a result of launching run.bat, the SSH connection will be established to the IP address from the IP.txt file, and the commands from the com.cli file will be executed.

 

KB-00438

Articles in this section

Was this article helpful?
3 out of 4 found this helpful
Share

Comments

0 comments

Please sign in to leave a comment.