Have you ever wanted to have a link in a web page open up an application on your computer?
There are a few unique use cases for wanting to add some functionality to an internal Web application or Web document that will allow you to open a different program on the client system.
An example use case would be clicking on a custom link on an internal website or web app that would open up a corresponding application that you need to work with.
Let’s say you have a web app with some client details and you wanted to make a link that would open the notepad application on the client machine. While this very simple example does not have a lot of practicality, it highlights a unique opportunity for certain use cases. By default, Windows limits the ability to open applications from a web interaction for security reasons. (Obviously). However, you can define a custom protocol for your users that would need to be configured on the target client machines.
For the notepad example, you could create a custom protocol called “open-notepad”.
In your HTML, you could put in something like this:
<a href="open-notepad://">Click here to open Notepad</a>
By Default, a webpage with this link in it will do nothing, as the browser only understands certain defined protocols like HTTPS or mailto: etc.
Now let’s say you wanted this to open Notepad on the target machine. You would need to add some registry entries to tell your system what to do with this protocol. In the following example, you would create a file called registerNotepadProtocol.reg and load it with the following contents:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\open-notepad]
@="URL:Open Notepad Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\open-notepad\shell]
[HKEY_CLASSES_ROOT\open-notepad\shell\open]
[HKEY_CLASSES_ROOT\open-notepad\shell\open\command]
@="\"C:\\Windows\\System32\\notepad.exe\""
This will register the “open-notepad” protocol to the system.
Now if you click on the link in a website/web app, Notepad will open!
While this is all well and good, it doesn’t serve much purpose. In our case, we wanted our Custom Managed IT Server monitoring dashboard to give us the ability to launch the appropriate RMM (Remote Monitoring and Management) platform specific to the server or device in question (Apsyn manages a large number of very different devices, and not all are accessed in the same ways).
We needed to add custom protocols to Windows and the appropriate links to the dashboards to open up the associated Remote Control suite.
We will use TeamViewer as an example. To open a TeamViewer session from the command line, you would run the command
teamviewer.exe -i 123456789
With 123456789 being the ID of the computer.
We could register a custom Protocol called “open-teamviewer” in the same way we registered notepad.
The associated URL to open it would look something like this:
<a href=”open-teamviewer://123456789″>Open Teamviewer ID 123456789</a>
The challenge is that Windows will pass the full string of the URL to the registry handler: “open-teamviewer://123456789”
We need to intercept the URL and strip out the ID and format the command to be run in the end as: teamviewer.exe -i 123456789. Otherwise, we would have to create a separate and custom handler for each connection ID.
We created a PowerShell script called open-teamviewer.ps1. You can download it here: https://github.com/boba-feh/aspynblog/blob/main/open-teamviewer.ps1
We set it up to log connection events for troubleshooting:
![]()
Ensure you remember where you saved it! You will need it for the REG entry.
Now you need to load the appropriate registry entry into the registry. We have a link to an example file you can edit here:
https://github.com/boba-feh/aspynblog/blob/main/registerTeamviewerProtocolLauncher.reg
![]()
Boom! now that link in your web app or document will open up the TeamViewer app to the device specified in your custom URL!
TeamViewer is just one example; we have used custom protocols for a variety of applications to help Nanaimo Business with their day-to-day workflow! Fewer clicks and navigating = more productivity!
Do you have any workflow or automation challenges you would like Aspyn to take a crack at? Contact Aspyn Information Services for affordable Managed IT Services, IT Support, Custom Scripting, and Process Streamlining!