Skip to main content
DPadula
Staff & Editor
Staff & Editor
August 21, 2024

Troubleshooting Tip: Preparing windows machine to run Tera Term scripts

  • August 21, 2024
  • 0 replies
  • 2615 views

Description

This article describes how, sometimes, to troubleshoot an issue, it is necessary to collect a few commands at regular time intervals. For example, to identify which process is causing a memory leak, it is necessary to collect memory output commands every few minutes and compare the results.


Fortunately, this task can be automated using Tera Term scripts. In this article, a Windows machine to run those scripts automatically will be prepared. 

Scope

All FortiGate versions.

Solution

As described in the article Technical Tip: TAC debug script with TeraTerm a script was crafted to collect the required useful debug commands that Fortinet TAC Support will use to investigate the issue. 

 

Pre-requirements:

  • Windows endpoint.

  • TeraTerm version 5.3 or higher.


Step 1: Download Tera Term version 5.3 or higher from the GitHub link. 

 

Step 2: Install Tera Term as any other software for Windows, and keep all the default settings.

 

Step 3: Connect to the FortiGate using SSH.

01.png

 

During the first time connecting to the FortiGate, the following message will be shown. When it appears, press Continue.

 

ssh_key.png

 

Step 4: When running a default TAC_debug_script, do not change any log settings. The log will be generated in the directory 'C:\FTNTTACDebug' when the script begins.

03.png


If TAC provided a customized Tera Term script and instructions to enable logging, go to File -> Log -> Browse to the desired log folder -> Enter a file name.

02.png


Notes:

  • If Tera Term uses its own installation directory as a log location, the log is actually stored in '%LOCALAPPDATA%\VirtualStore\Program Files (x86) eraterm' by default.

  • If the script gets logged out automatically, adjust the login timeout period following this command:

config system global
    set admin-ssh-grace-time <number_of_seconds> << max 3600 seconds
    set admintimeout  <number_of_minutes< << max 480 minutes
end 


Step 5: Once Tera Term is connected to the FortiGate, select Control -> Macro. 


macro.png

 

Step 6: Select the script provided by TAC or download from the Technical Tip: TAC debug script with TeraTerm article.

 

select_ttscript.png

 

Step 7: The password will be requested one more time, type it and press OK.

 

password again.png

 

After that, the script should be running, and it will display a small window showing the loop count.

 

Script running.PNG

 

Follow the TAC instructions and upload the logs collected to the ticket as instructed by the TAC engineer. 

    Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
    Virtual event | September 2026. SASE summit. The age of autonomous trust. Register here!