TapeTrack Documentation

Because there is more to tape management than you ever realized

User Tools

Site Tools


technote:cgi
 
 

This is an old revision of the document!


Running TapeTrack Utilities via Apache CGI

Configure Apache on Windows to allow execution of TapeTrack command-line utilities (such as TMSS10Inventory.exe) directly from a web browser using CGI.

This is useful for generating TapeTrack reports (CSV, text, etc.) through a simple URL call.

Overview

By default, Apache only executes CGI programs from a configured CGI directory (normally /cgi-bin).

To run TapeTrack executables without copying them into Apache’s CGI folder, we will:

Create an Apache ScriptAlias pointing to the TapeTrack executable directory

Enable ExecCGI for that directory

Allow Apache to treat .exe files as CGI scripts

Run TMSS10Inventory.exe from a web browser to generate an inventory report

Prerequisites

Apache 2.4 installed on Windows (example path: C:\Apache24)

TapeTrack Server Utilities installed (example path: C:\Program Files\TapeTrack\TapeTrack Server Utilities\bin\tapetrack)

TMSS10Inventory.exe present in the TapeTrack folder

Apache running as a Windows Service or console process

Step 1: Locate the TapeTrack Executable Folder

TapeTrack utilities are typically located in:

 C:\Program Files\TapeTrack\TapeTrack Server Utilities\bin\tapetrack 

Confirm the file exists:

 TMSS10Inventory.exe 

Step 2: Edit Apache Configuration

Open the Apache configuration file:

 C:\Apache24\conf\httpd.conf 

Add the following configuration near the existing ScriptAlias section.

Step 3: Add ScriptAlias for TapeTrack

Add this line:

 ScriptAlias /tapetrack/ "C:/Program Files/TapeTrack/TapeTrack Server Utilities/bin/tapetrack/" 

This creates a new URL path:

 http://localhost/tapetrack/ 

which maps directly to:

 C:\Program Files\TapeTrack\TapeTrack Server Utilities\bin\tapetrack\ 

Step 4: Enable CGI Execution for .exe Files

Add this directory block:

 <Directory "C:/Program Files/TapeTrack/TapeTrack Server Utilities/bin/tapetrack"> AllowOverride None Options +ExecCGI Require all granted AddHandler cgi-script .exe </Directory> 

This tells Apache:

allow CGI execution in this folder

treat .exe files as CGI programs

Step 5: (Recommended) Restrict Access to Localhost Only

For security reasons, it is strongly recommended to restrict execution of TapeTrack executables to the local machine only.

Replace:

 Require all granted 

with:

 Require local 

Final recommended configuration:

 ScriptAlias /tapetrack/ "C:/Program Files/TapeTrack/TapeTrack Server Utilities/bin/tapetrack/"
 
<Directory "C:/Program Files/TapeTrack/TapeTrack Server Utilities/bin/tapetrack">
AllowOverride None
Options +ExecCGI
Require local
AddHandler cgi-script .exe
</Directory>

Step 6: Restart Apache

After saving httpd.conf, restart Apache.

From an Administrator Command Prompt:

 net stop Apache2.4 net start Apache2.4 

Or restart Apache via Windows Services.

Step 7: Test Execution in Web Browser

Open a browser and visit:

 http://localhost/tapetrack/TMSS10Inventory.exe 

If CGI is configured correctly, Apache will execute the program instead of downloading it.

Step 8: Running TapeTrack Inventory Report from Browser

TapeTrack utilities accept command-line arguments. CGI allows passing arguments via the query string.

Example command normally run from command prompt:

 TMSS10Inventory.exe -S tapemaster:-@localhost 

To run this through the browser, use:

 http://localhost/tapetrack/TMSS10Inventory.exe?-S+tapemaster:-@localhost 

Notes:

? begins the argument list

spaces are replaced with +

Step 9: Setting Report Format (CSV Output)

TapeTrack utilities can output different formats depending on environment variables.

To force CSV output, the variable may be required:

 TMSSREPORTFORMAT=CSV 

Because environment variables cannot easily be set directly from a URL, it is recommended to set this globally for Apache or use a wrapper script if required.

Option A: Set TMSSREPORTFORMAT Globally for Apache

Add the following to Apache configuration (inside global scope):

 SetEnv TMSSREPORTFORMAT CSV 

Restart Apache after making changes.

This forces TapeTrack utilities run via Apache CGI to output in CSV format.

Example: Generate CSV Inventory Report

Once TMSSREPORTFORMAT is set, run:

 http://localhost/tapetrack/TMSS10Inventory.exe?-S+tapemaster:-@localhost 

The browser should display the CSV output, or prompt to open it in Excel.

Troubleshooting

Browser downloads the EXE instead of running it

Check:

Options +ExecCGI exists in the Directory block

AddHandler cgi-script .exe exists

the directory path is correct

Apache has been restarted

Output is blank

Possible causes:

The TapeTrack executable is writing output to a file instead of stdout

TapeTrack is failing due to permissions (Apache service account)

Missing environment variables (example: TMSSREPORTFORMAT)

TapeTrack cannot connect to the TapeTrack server

Check Apache logs:

 C:\Apache24\logs\error.log 

TapeTrack utility works in CMD but not in browser

Apache runs under a service account (often LocalSystem). That account may not have access to:

TapeTrack registry settings

network resources

configuration files

authentication credentials

Fix: configure Apache service to run as a specific Windows user with access to TapeTrack.

Security Warning

Executing .exe files over HTTP is powerful and potentially dangerous.

Recommendations:

Use Require local to limit access to the machine only

Do not expose this server to the internet

Consider firewall restrictions

Only allow execution in a controlled folder

Summary

To run TapeTrack utilities like TMSS10Inventory.exe through Apache:

Add a ScriptAlias pointing to the TapeTrack utility folder

Enable ExecCGI on that directory

Add handler mapping for .exe

Restart Apache

Run the program via browser URL with query string parameters

Example URL:

 http://localhost/tapetrack/TMSS10Inventory.exe?-S+tapemaster:-@localhost 
technote/cgi.1771473722.txt.gz · Last modified: 2026/02/19 04:02 by Scott Cunliffe