HTML Apps

August 26th, 2009 Leave a comment Go to comments

HTML Applications (HTAs) are surprisingly powerful tools. An HTA is essentially just a web page, but instead of having a .html or .htm extension, it has a .hta extension.  When you doubleclick a .hta file on a Windows computer, it launches in mshta.exe, which is basically a simple web browser with one special ability.  It can execute local scripts, something a regular web page cannot do.  For this reason, it’s an ideal way to easily create a GUI for your scripts.

I’ve posted a handful of HTAs below that I use on a daily basis, but I’ve separated each script into its own file to make things a bit clearer in this post.  You could easily combine numerous scripts into a single HTA if you are so inclined.  I hope you find them as useful as I do.

***************************************************************************

***************************************************************************

get_sql_db_sizes

Retrieve a graphical representation of SQL databases on a server and display how much space is used in each database file

SQL 2000 had a view that was similar to this, but you could only see it for one database at a time. In SQL 2005, they removed it altogether, but in my work environment, we have tons of very large databases, and it’s very important for me to be able to see a quick snapshot of how much space is used in all of the databases on any remote SQL server.  There is also an option to export the report straight to Excel.  I use this HTA constantly throughout the day, and of all the tools I’ve created, this is definitely one of my favorites. To connect to a default instance, simply enter the server name or IP.  To connect to a named instance, use ServerName\InstanceName.  To connect to a SQL Express instance, use ServerName\SQLEXPRESS.

Download – Get_SQL_DB_Sizes.hta

***************************************************************************

***************************************************************************

getdiskspace

Retrieve disk space from a remote computer

In order to retrieve the disk space breakdown on a remote computer, your user account will need to be in the local administrators group on the remote machine.

Download – GetDiskSpace.hta

***************************************************************************

***************************************************************************

get_sql_backup_history

Retrieve SQL backup history

Here’s another HTA example of connecting to SQL.  This script retrieves database backup history information from the MSDB..backupset table.

I also have a T-SQL version of this script posted which you can check out here: T-SQL Backup History Script

Download – Get_SQL_Backup_History.hta

***************************************************************************

***************************************************************************

Get_General_Info

Retrieve Model, Serial Number, RAM, OS, Last Boot Time and more

This HTA retrieves some general info from computers on your network.  Your user account needs to be in the local administrators group on the remote machine.

Download – Get_General_Info.hta

***************************************************************************

***************************************************************************

Get_dbInfo

Retrieve general database info from SQL

This HTA retrieves some general info about the databases on a SQL server.  This won’t work on SQL 2000 but will work on 2005 and 2008.

Download – Get_SQL_DBInfo.hta

***************************************************************************

***************************************************************************

get_sql_spwho2_and_inputbuffer

Retrieve SP_WHO2 and Input Buffer from SQL Server

Here’s another example of retrieving info from SQL Server.  The sp_who2 script will work on all three versions of SQL, but the InputBuffer script will only work on 2005 and 2008.

Download – Get_SQL_spwho2_and_InputBuffer.hta

***************************************************************************

***************************************************************************

diffBackupPredictionHTA

SQL Differential Backup Size Prediction

Sometimes it can be very handy to know how large a differential database backup will be before actually executing the backup.  This HTA will accurately estimate the differential backup size.  Credit goes to Darwin Hatheway for explaining how to do this here.

Download – SQL Differential Backup Size Prediction - HTA

T-SQL Version – http://dougzuck.com/sql-differential-backup-size-prediction

  1. Gail Selsmeyer
    June 12th, 2009 at 09:40 | #1

    Thanks for showing me something new to learn and providing the code to learn it from. I really appreciate the sharing of knowledge. Especially so since I’m new to SQL Server and as a SQL DBA and still have all my other responsibilities.

  2. SG Ram
    October 24th, 2009 at 21:02 | #2

    AWESOME. Great work!!

  3. Orazio
    November 20th, 2009 at 05:57 | #3

    very good work!!
    it’s useful utility.
    good bye

  1. No trackbacks yet.