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.
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:
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
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\
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.
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>
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.
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.
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
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.
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
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.
Executing .exe files over HTTP is powerful and potentially dangerous. Recommendations: