Table of Contents
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:
- Create an Apache ScriptAlias pointing to the TapeTrack executable directory
- Enable ExecCGI for that directory
- Allow Apache to treat .exe files as CGI scripts
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)
- Apache running as a Windows Service or console process
Locate the TapeTrack Executable Folder
TapeTrack utilities are typically located in:
C:\Program Files\TapeTrack\TapeTrack Server Utilities\bin\tapetrack
Some installations may place the TapeTrack install on anther drive, such as D
Edit Apache Configuration
Open the Apache configuration file: C:\Apache24\conf\httpd.conf
Add the following configuration near the existing ScriptAlias section.
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\
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.
(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>
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.
Test Execution in Web Browser
Open a browser and visit:
http://localhost/tapetrack/TMSS10Inventory.exe?S=user:-pass@localhost
Replace user and pass with actual username and password.
If CGI is configured correctly, Apache will execute the program instead of downloading it.
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 user:-passsword@localhost
To run this through the browser, use:
http://localhost/tapetrack/TMSS10Inventory.exe?S=user:-pass@localhost
Notes:
? begins the argument list
spaces are replaced with +
To avoid using your password in plain text in the URL, create a file C:\tapetrack\pw\user where user is the username and the contents of the file is the users password. The -S arg only needs to specify -S user@locahost and the password will be looked up by the process.
Attributes are separated using the & symbol
Setting Report Format
TapeTrack utilities can output different formats depending on environment variables.
To force CSV output, the variable may be required, in a command prompt:
TMSSREPORTFORMAT=CSV
Other formats are text (default), PDF & Excel.
Using CGI, to set the report format locally, use the variable RPT
http://localhost/tapetrack/TMSS10Inventory.exe?S=user:-pass@localhost &RPT=CSV
Or if the report format stays as CSV, you can set the value globally.
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.
Report Variables
All report Variables can be used similar to the command line interface, with the exception of syntax.
A command line example of calling TMSS10Inventory, with access details, customer filter and CSV output.
set TMSSREPORTFORMAT=CSV TMSS10Inventory -S user:-pass@localhost -V UK01.*.*
Apache/CGI
http://localhost/tapetrack/TMSS10Inventory.exe?S=user:-pass@localhost&V=UK01.*.*&RPT=CSV
Example: Generate CSV Inventory Report
Once TMSSREPORTFORMAT is set, run:
http://localhost/tapetrack/TMSS10Inventory.exe?user:-pass@localhost
The browser should display the CSV output, or prompt to open it in Excel.
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
