Tag Archives: HTAs

Another Old HTA: WoL Manager

There’s a not so recent post that I wrote that discussed two old HTAs (HTML Applications) that I wrote long ago. I decided to link the post on the, The Scripting Guys’ Facebook Page (direct link: https://www.facebook.com/groups/5901799452/permalink/10154015674414453). It seemed to me that this group of people might be interested in these HTAs. It made sense, as I had learned plenty about VBS and HTAs from The Scripting Guy, Ed Wilson himself. It turned out to be good idea to share those old HTAs, as there were many downloads. If anyone really used them, I can’t honestly even say.

Someone back when I did this asked if I can, or would, add WoL (Wake on LAN), to the LoggedOnUser HTA. I think the idea was that if the computer didn’t respond, that it would leave the option to wake the computer. While I’m not interested in spending time adding that feature (unless there’s cash involved, or a whole lot of Chipotle gift cards), I did mention another HTA I had written back in my VBS/HTA days, called WoL Manager.

This HTA’s sole purpose was to wake up computers in a computer lab. I had opted to try and save some money by reducing electricity costs, by allowing the lab computers to drop into hibernation, or some form of deep sleep when they weren’t being used during the day, each evening, and over the weekends. It was an often used lab during all hours of the day. Being that I’m very much into Windows PowerShell and automation in general, you can understand that I would rather not walk to the lab every time I needed to wake up a computer. No, I would rather send a WoL magic packet, give it a moment, and then remotely connect to the system, which I did for a few years. The last time this thing was used, was… 2013.

We’ll start by looking at the WoL Manager HTA and then discuss a little more about it. There’s some things you’ll need to know if you opt to try it out. I’ll include a download link at the bottom of this post. Here’s three different views of the HTA: (left) when the HTA is first opened, (center) when the HTA is ready to wake a single computer, and (right) when the HTA is ready to wake all the computers.

script-sharing-another-old-htas-wol-manager-2015-01     script-sharing-another-old-htas-wol-manager-2015-02     script-sharing-another-old-htas-wol-manager-2015-03

Much like the LoggedOnUser HTA, this one also requires a computers.txt files arranged like the example below (name, colon, MAC address). The file needs to remain in the same directory as the HTA. The download includes this file which can be easily edited.

Server01:053ae714eaca
Server02:0044e924f241
Server03:0034e734f2a2
Server04:0043e944f5a3
Server05:0034e654a533
Server06:0043e664e3d3

The HTA requires a third-party executable to wake the computer, which I’m not distrubuting. It’s called wol.exe and can be downloaded here: http://www.gammadyne.com/cmdline.htm#wol. Make sure this executable is located in the same directory with the HTA and computers.txt file, too.

In the environment where I (used to) use WoL Manager, I was able to use the wol.exe command line tool, such as:

PS> wol.exe 0043e944f5a2

It did not require that I include an IP address, like it does in the second example back on this page: http://www.gammadyne.com/cmdline.htm#wol, or in my below example. If your environment requires the IP address of the computer where the HTA is running (not the computer you’re trying to wake), then the HTA will need to be modified (which you’re welcome to do). I think there’s some commented out HTML at the bottom where I may have been getting ready to add this option. I don’t believe there’s any logic in the HTA, however.

I used this same wol.exe executable at home to wake up my desktop computer, although at home, it’s used as part of a Windows PowerShell function. To use this there, my laptop’s IP must be included to wake up the home desktop, such as:

PS> wol.exe 0043e944f5a2 10.10.10.33

If you’re interested in this HTA, start by downloading wol.exe and seeing if it works, first. Also, you may have to make some modifications to the system(s) in which you want to wake, but I’m sure Google, or Bing, can help with setting up the NIC(s) to accept WoL magic packets, if they don’t already.

One final note: I cannot remember for the life of me if the Wake All option actually works, or not. I briefly looked a the subroutine called by clicking that button, and it looks good. Someone might want to let me know. After writing all this, and reading it two years later, maybe I understand why this post as been sitting in my drafts for so long. Enjoy, if you try it and it works!

You can download this HTA here: WoLManager1.1.zip (10310 downloads )

Two Old HTAs: LoggedOnUser and Remote Desktop Assistant

There was a recent Windows PowerShell forum post that discussed HTAs. Due to that, I thought I would discuss a couple old HTAs I wrote and include their download links. Many people may not know it, but I was once a VBS aficionado. I had a task to set some registry settings back in 2005, or 6, and ended up staring some VBS examples right in the face. I was instantly hooked. I starting writing all kinds of things, and today I’m going to share two of my old HTAs — a couple favorites.

HTAs are HTML Applications. They allowed script writers, such as myself, the ability to create GUIs for their scripts. I suddenly had a way to hand over scripts in an easy to use fashion for users, and other IT personnel.

Funny story, but when Windows PowerShell — a.k.a Monad — was first introduced, I was excited at first, but then I was pissed (upset, not drunk). I had put so much time and effort into VBS, that moving to something else was upsetting. I’ve gotten over that now; I would need an extremely large pay day, to write and/or troubleshoot any VBS.

The first of the two HTAs I’ll share is called LoggedOnUser (1.6). Its original purpose was to determine who was logged on to a specific computer. Here’s what the HTA looks like when it’s first opened.

script-sharing-two-old-htas-loggedonuser-and-remote-desktop-assistant-2015-01

While you may not know what to do right away, there’s a tooltip that displays when you hover over the textbox, that reads, “Enter computer name, IP address, cmd or exit.” If someone entered “cmd” and pressed Enter, it would open the command prompt. I guess that seemed important at the time. If you entered “exit” and pressed Enter, then the HTA would close. Hopefully no one had a computer named cmd or exit! I wrote this for myself, so I assume I wasn’t worried about that possibility. If a computer name or IP is entered, it would attempt to connect over the network (using VBS and WMI), and populate three fields: Computer (as in the computer’s name), the currently logged on user as domain\user, and the full domain. Here’s an example:

script-sharing-two-old-htas-loggedonuser-and-remote-desktop-assistant-2015-02

After some time had passed, I decided to do more with this daily used HTA. I added a drop down menu that would perform different tasks, such as open C$, open Computer Management, and start a Remote Desktop Connection to the listed computer.

script-sharing-two-old-htas-loggedonuser-and-remote-desktop-assistant-2015-03

It was a fun project and the HTA was actively used from 2007 to probably 2013, by myself and at least one other IT shop. In my 1.5 version (one previous to this 1.6 version), there was a drop down option that opened up an inventory system to the listed computer’s inventory webpage. The inventory system had been built using a .vbs start up script deployed via Group Policy. It would collect computer information (including the logged on user), and write it to an Access database back end (yes, Access). Classic ASP was used for the web front (yes, classic ASP). Good times. I can say this: learning VBS made learning classic ASP extremely easy.

You can download this HTA here: LoggedOnUserv1.6 (7078 downloads )

The second HTA I’ll share was an amazing test of my patience. I’d like to thank Tool’s 10,000 Days for getting me through it.

I called this one Remote Desktop Assistant and its purpose was to store computer descriptions and matching IP addresses, or computer names. Choosing a computer from the list would allow a user to start a Remote Desktop Connection. This first screen shot shows the HTA when there are no stored computers. Let’s add one.

script-sharing-two-old-htas-loggedonuser-and-remote-desktop-assistant-2015-04

This image below, is what it looks like when it’s storing a computer for us. It stores this information in a computers.txt file in the same location as the HTA. Move the HTA and not the text file, and no computers will be listed, and the HTA will create a new computers.txt file. Yes, it’s creates this file if it can’t find one. With a single computer entered, such as we have below, the text file would contain one line that reads: Server01;10.10.10.35. It’s two strings with a semi-colon delimiter.

script-sharing-two-old-htas-loggedonuser-and-remote-desktop-assistant-2015-05

The server (Server01), in the image above was added by entering a description in the “Computer Description” textbox, and a corresponding computer name or IP address in the “IP Address or Computer” text box. When a user clicks on the computer in the left, it populates the the two textboxes and changes the “Choose Computer” button to a “Launch Remote Desktop” button. Do you see all this fanciness!?

script-sharing-two-old-htas-loggedonuser-and-remote-desktop-assistant-2015-06

If you press “Launch Remote Desktop” then it will do just that. The three bottom buttons: About…, Notes, and Feedback, offer some additional information about the HTA. It’s nothing monumental, but I was pleased with my ability to resize the form and replace the text in the lower area. The Hide button closes the lower, informational panel. Take a look below to see what I mean.

script-sharing-two-old-htas-loggedonuser-and-remote-desktop-assistant-2015-07

script-sharing-two-old-htas-loggedonuser-and-remote-desktop-assistant-2015-08

Well, that was a fun trip down memory lane. Who knows, these might actually be helpful for someone. One of the things I did, which I may share in a future post, was rewrite the LoggedOnUser VBS/HTA using PowerShell. There’s no GUI, but it does everything that HTA does, way faster, and with much less code. As you check these out, please keep in mind I wrote these around 2005 – 2007, or 8. Cheers!

You can download this HTA here: RDAssistantv2.1 (9770 downloads )

Update: Use PowerShell and Active Directory to create your computers.txt file: http://tommymaynard.com/quick-learn-prep-computers-txt-file-for-hta/.