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 find useful, 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. 


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, so here is a way you can get the same results using an HTA.  There is also an option to export the report straight to Excel.  To connect to a default instance, 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


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


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


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


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


Retrieve CPU details from a computer

This HTA retrieves the CPU details for a given computer.

Download – Get_CPUInfo


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


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. However, since he didn’t complete the implementation, I did it myself.

Download – SQL Differential Backup Size Prediction - HTA

T-SQL Version –

  1. #1 by Gail Selsmeyer on June 12, 2009 - 9:40 am

    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. #2 by SG Ram on October 24, 2009 - 9:02 pm

    AWESOME. Great work!!

  3. #3 by Orazio on November 20, 2009 - 5:57 am

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

  4. #4 by Pondiboy on April 29, 2011 - 5:24 am

    This is awsome. Very useful

  5. #5 by Bright on August 4, 2011 - 10:08 am

    This is superb. Thanks!

  6. #6 by Nessie on September 21, 2011 - 7:44 am

    These are great, many thanks… would it be possible to out a trigger on the SQL DB Sizes hta so that if the DB reaches say 80% the bar turns Red…

    Also I’m trying to to bring 5 of the apps into one hta with drop down menus to select which one you want to run…

  7. #7 by Jazz on April 30, 2012 - 7:20 am

    Cool! Thank You!

  8. #8 by JJ on September 24, 2012 - 8:12 pm

    Greate work.. really helpful

  9. #9 by Steve Sofar on April 5, 2013 - 11:00 am

    Wow you HTML stuff are so great
    I wish we could use the SQL Authentication vs the windows trsuted connection to connect to a SQL server box, because i have few domains
    (but at least the SQL Login is always the same)

    Nessie did you succeed to bring 5 of the apps into one hta with drop down menus

    • #10 by doug on April 5, 2013 - 7:30 pm

      I don’t have the exact syntax off the top of my head for the connection string, but you should be able to modify it very easily to use SQL authentication instead of Windows auth.

  10. #11 by me on May 29, 2013 - 2:20 am

    Cooool mate! Cheers!

  11. #12 by chetan on April 13, 2014 - 4:41 pm

    Need free space from volumes that are mounted on folders instead of drive letter

  12. #14 by Pato on October 23, 2014 - 6:01 pm

    Hi doug, first thank you for this scripts, they are very useful.
    I was playing with your script “Get_General_Info.hta” and found that you have disabled the parameters to get the CPU information. I have enabled them and added the results parameters. But im getting a wrong processor number result, for example im getting that the VM has 1 processor when it has 8. Any clue?. Thank you again.

    • #15 by doug on November 5, 2014 - 1:50 pm

      Hi Pato – I added another HTA above that gets the CPU details.


  13. #16 by jeff on March 27, 2015 - 9:20 am

    Hi – thanks for these scripts. The information is so basic yet most needed in a pinch. They are now a permanent part of my toolset.

    • #17 by doug on March 27, 2015 - 12:01 pm

      You’re welcome, Jeff! I’m glad you find them so useful.

  14. #18 by chethan on June 23, 2015 - 1:41 am

    Hi Friend,

    This are awesome scripts and codes , basically i am mediocre php programmer with HTML and CSS knowledge but on filp side my main role is System Administrator. We have more than 100+ systems in our office i wanted to create an application which can monitor and send system info to server on regular basis. After that i know how to use that data stored in server and use it to display in GUI so i can have all asset details and also monitor there performance… can you send me your contact details so if i have any doubt i can ask and i want to release it as free app once its complete .. and thanks for the guide…

  15. #19 by ASHISH on August 12, 2015 - 12:39 am

    Hello Doug,

    I’m a newbie to HTA world.
    Can the HTA solutions be implemented in HTML5 as well ?

    • #20 by Frank on September 13, 2015 - 5:00 pm

      One Point: In IE 10 mode and above cant set hta properties.
      Have a start.hta in i.e. content=”IE=8″, load from there your hta (renamed as html) with i.e. content = “IE=11”.

      you have full HTML access and full HTA.


(will not be published)