RDP Hyperlink

February 21st, 2010 Leave a comment Go to comments

I recently started using Zenoss (an open source application, server and network management platform) to monitor servers. One of the options that can be configured for each of the devices being managed is a hyperlink that can open a website or application of some relevance. In a situation where I am informed of an issue with a server/application I instinctively try to open a Windows remote desktop session to the server. This used to involve manually opening the Microsoft Terminal Services Console (mstsc.exe), keying the server name and then clicking the connect button. I wanted a way to click a hyperlink from the Zenoss web console and establish an rdp session to the relevant server.

Since some protocols are identified by a prefix (ftp:// http:// https://) I decided to use rdp:// as the prefix to launch mstsc.exe. I have combined the necessary registry keys and the required JScript file into a single .bat file that allows for easy installation/uninstallation of the rdp hyperlink association. When you run rdp.bat you are presented with 3 options:


Option 1. Adds registry key HKCR\rdp which contains the parameters needed to associate the rdp:// prefix with a file created in C:\Windows called hyperlink-rdp.js. The JScript file is responsible for some string manipulation that trims the rdp:// prefix and then passes the remaining string (server name) to mstsc.exe to try and establish the rdp session.

Option 2. Removes registry key HKCR\rdp and the C:\Windows\hyperlink-rdp.js file.

Option 3. Exits the batch file.

After you use rdp.bat to create the hyperlink association you can launch an rdp session by clicking any hyperlink in the form of:


Typing rdp://someserver into your browser or windows explorer address bar will also launch the Microsoft Terminal Services Console and attempt to establish a session.

Note: When clicking an rdp:// hyperlink for the first time from a browser it is likely that you will receive a prompt that the browser is trying to launch a local application. You will need to allow this in order for the Microsoft Terminal Services Console to be opened and a session established.

After creating the rdp association on my Windows computer I added a specific link to the device in my Zenoss web console by:

1) Navigating to the device
2) Clicking the options drop down arrow
3) Selecting More --> zProperties
4) Adding a HTML hyperlink to the zLinks property

The syntax for a standard HTML hyperlink is:

<a href="rdp://someserver">rdp://someserver</a>

Although the above hyperlink works, I later discovered that Zenoss makes use of TALES expressions, one of which can be substituted for the server name (someserver) in this instance. If you use TALES you would only need to set the hyperlink once globally for all Windows servers by:

1) Navigating to Devices --> Server --> Windows
2) Clicking the zProperties tab
3) Adding the Zenoss TALES hyperlink to the zLinks property

The syntax for the Zenoss TALES hyperlink is:

<a href="rdp://${here/id}">rdp://${here/id}</a>

You will then have a clickable hyperlink on the Status tab from within the Windows device (or any new devices you add if you use the Zenoss friendly hyperlink):


Note: If you are planning to run rdp.bat on Windows Vista or Windows 7 you will need to run it with Administrator privileges. You can do this by right clicking rdp.bat and choosing 'Run as administrator':


Download rdp.bat - HERE

Note: Since this article I have also written another post on creating SSH and SCP Hyperlinks

  1. February 22nd, 2010 at 21:33 | #1

    Even better than
    would be to use
    in the device class for your Windows boxes. This will automatically use the id from the device and apply that zLink to all of your devices.

  2. February 22nd, 2010 at 21:34 | #2

    Hmm... it ate my code. The important thing to note is replacing "someserver" with "${here/id}" and it will use TALES to fill in the right device id.

  3. James Clements
    February 23rd, 2010 at 11:50 | #3

    Thanks Matt! I wasn't aware of TALES expressions on Zenoss/Zope before you mentioned them. I have updated the post accordingly.

  4. Dalton
    May 28th, 2010 at 22:22 | #4

    Just wanted to thank you for this batch script. I used it for zenoss and also copied and modified it to add keys for SSH.

  5. anonymous
    November 15th, 2010 at 09:55 | #5

    mmm...just what I was looking 4, but 2 bad it says the zip is corrupted. Downloaded from different sites, same result ๐Ÿ™
    Can u upload a new zip (or bat)

    thanks, good work.

  6. James Clements
    November 15th, 2010 at 17:38 | #6

    I have just tested the download and it seems fine. Post a follow up comment or drop me an email with your real email address and I will email it to you if you are still experiencing problems.

  7. Mike Wright
    December 1st, 2010 at 11:10 | #7

    Is there a workaround for getting this into shitpoint/moss? It only seems to accept 'standard' protocols e.g. http/s file ftp mailto news ??

  8. James Clements
    December 1st, 2010 at 15:57 | #8

    Mike, your question is slightly off topic (as you are experiencing a SharePoint issue) but Google helped me find this:


    The URL used in that article is different but the principle looks to be the same to get what you need working.

  9. February 22nd, 2011 at 13:50 | #9

    Is there a setting in Google Chrome that would prevent this from working? It seems that when I enter rdp://ip scp://ip or ssh://ip in Google Chrome the browser will search for the content rather than launch the appropriate application.

    The scripts do work great in Firefox and IE.

  10. May 23rd, 2011 at 14:47 | #10

    Hi, this has been a great script, as will provide me to link each customers profile as a web link on the intranet avoiding the neccesity of copy/pasting the customers server IP address.

    What would be really great is to be able to specify the user which RDP should use to login, Iร‚ยดve tried what has been suggested here: For example: rdp://${} but for some reason is not working. Am I missing something?

    Thanks in advance

  11. James Clements
    May 23rd, 2011 at 17:20 | #11

    Hi Fernando, nope you aren't missing anything. At the moment it isn't possible to specify the username when connecting using my script. I will look at modifying it for your purpose though ๐Ÿ™‚

  12. June 23rd, 2011 at 20:08 | #12

    Thanks James, this script has proven to be extremely useful!

  13. Mark B
    August 7th, 2011 at 09:37 | #13

    Same comment as Konrad, it really was useful. Thanks.

  14. Claudio
    August 23rd, 2011 at 18:29 | #14

    Thanks James, very useful.
    Is there any way to add a parameter to point to an .rdp file?...

  15. Tika
    August 29th, 2011 at 15:10 | #15

    Thanks James, it was really useful.

  16. Eric
    September 1st, 2011 at 19:36 | #16

    Thanks! This script is incredibly useful.

  17. David
    September 13th, 2011 at 12:52 | #17

    Great job, this script has proven to be extremely useful! Thanks.

  18. daya
    September 16th, 2011 at 08:27 | #18

    @James Clements

    Hi James,
    I'm new to web technology and I'm developing html page, I want to create a link and on click of the link 'Remote Desktop' should open. I walk thru the above blog and found rdp.bat & rdp://servername. This html page will be accessed by different user in same organization, do I want to iinstall rdp.bat in all the user's m/c or only in the server?

    Thanks in advance.


  19. Dennis
    October 6th, 2011 at 12:16 | #19

    Hi James,

    My Windows XP Professional uses C:\WINNT instead of C:\Windows as default windir. Any workarounds to make RDP Hyperlink work? Thanks


  20. John
    October 10th, 2011 at 13:06 | #20

    Many thanks for this. Quick and easy solution!

  21. December 15th, 2011 at 20:43 | #21

    @James Clements

    That would be great. Great idea - I used it to extend the functionality of my intranet site. If I could pass domain\username and password it would be even more awesome.

  22. Jason
    April 12th, 2012 at 21:31 | #22

    This is a really great script. I've used it on a number of PCs to access an internal website and it works a treat. I would also like the ability to add the domain\username as well as maybe defining the screen sizes etc. However, I have a more urgent / pressing issue that I need to resolve. The script doesn't seem to work with Windows 7 64Bit. I have a few workstations that need to use it with this OS but I can't seem to get it to work. Can anyone help?

  23. April 20th, 2012 at 19:43 | #23

    Any chance you can get this working on Windows 8?

  24. April 25th, 2012 at 17:36 | #24

    This helped me a lot... thank you...

  25. Pargit
    August 20th, 2012 at 08:35 | #25

    Thanks man, that did the trick i was looking for ๐Ÿ™‚

  26. November 21st, 2012 at 15:41 | #26

    Great little script you put together. Is it possible to make it work with a .rdp save file from a file server. Something like rdp://\\server\RDP\connections.rdp Thanks!

  27. November 21st, 2012 at 20:00 | #27

    Never mind I figured it out. Thanks again!

  28. eltraviesolui
    January 9th, 2013 at 22:39 | #28

    2 Yrs later and this script is still making life easier! THANKS BRO! Just for reference in case someone out there is doing what I am doing: ** Using GestioIP IPAM software and wanted to add RDP as an option to the URL section for myservers. (easy quick link) This script allowed MSTSC/RDP/Remote Desktop to be called from the browser seamlessly! [ Tested: Win7, Win8, Srv 2008, Chrome, IE 9 &10] ** Thanks again...

  29. Micah
    January 9th, 2013 at 22:44 | #29

    Any way to get the rdp:// association to work on Mac? Obviously these registry changes won't work.

  30. Carl
    January 23rd, 2013 at 11:51 | #30

    I've used this method to try and setup hyperlinks for TeamViewer. I've setup the tmvw:// prefix, no problem. The problem comes when trying to pass arguments to the js file. How do I cater for more arguments? The format of the execution string is [TeamViewer exe location] -i [TeamViwerID] -Password [TeamViewer password]. eg C:\Program Files (x86)\TeamViewer\Version8\TeamViewer.exe -i 121345678 -Password blahblahblah.
    This is what I've got for hyperlink-tmvw.js

    var server=(WScript.Arguments(0))
    var prefix='tmvw://'
    var app='C:\\Program Files (x86)\\TeamViewer\\Version8\\TeamViewer.exe'
    server=server.replace(prefix, '')
    server=server.replace('/', '')
    var shell = new ActiveXObject("WScript.Shell")
    shell.Exec(app + " -i " + server)

    Any ideas on how to recognise a second (password) argument?

  31. Carl
    January 28th, 2013 at 08:55 | #31

    I got it working using:

    var substring=(WScript.Arguments(0))
    var mySplitResult = substring.split(/#/)
    var server = mySplitResult[0]
    var passw = mySplitResult[1]
    var prefix='tmvw://'
    var app='C:\\Program Files (x86)\\TeamViewer\\Version8\\TeamViewer.exe'
    server=server.replace(prefix, '')
    server=server.replace('/', '')
    var shell = new ActiveXObject("WScript.Shell")
    shell.Exec(app + " -i " + server + " --Password " + passw)

  32. Carl
    January 28th, 2013 at 09:00 | #32

    For the above the link looks like this:


  33. Scott Boyce
    February 28th, 2013 at 05:13 | #33

    Props to JJ & Carl! I was so inspired, I created 32-bit & 64-bit installers for TeamViewer & DameWare hyperlinks...
    TeamViewer Hyperlinks - http://www.mediafire.com/?tqvcy1rd6p6s7am
    DameWare Hyperlinks - http://www.mediafire.com/?c40d6gb5tcdgzs5

  34. Eyal
    April 6th, 2013 at 23:08 | #34

    If anyone interested, openning connection file instead of using servername is quite easy to implement.
    just remove the /v: in the batch file (where the shell.Exec is done), and instead of launching rdp with the server, it will be launched with the rdp file.
    so this link should work:

  35. Shoham
    May 30th, 2013 at 07:51 | #35


  36. Moh
    June 25th, 2013 at 21:17 | #36

    Thanks a lot, this batch is really useful!

  37. Ichigo
    November 29th, 2013 at 12:01 | #37

    Thanks for this ๐Ÿ™‚

  38. GregT
    February 28th, 2014 at 20:46 | #38

    @Scott Boyce

    Scott- Can you update the links for your Dameware and Teamviewer installers? They're expired.

  39. Mor
    March 6th, 2014 at 06:36 | #39

    i have installed the extension and also ssh & telnet, but ie8 doesn't seems to open the hyperlinks and give me:
    Navigation to the webpage was canceled
    What you can try:
    Retype the address.

    i had it working before i reinstalled my pc (same os/ver/softwares).
    any idea?

  40. March 12th, 2014 at 12:32 | #40

    James - Just found this and used it to create hyperlinks in all my Visio drawings to launch RDP sessions for desktops and servers, it works awesome! Thanks!

  41. Gary
    July 17th, 2014 at 18:43 | #41

    Can you send me the rdp.bat?

  42. David
    November 17th, 2014 at 08:16 | #42

    This is brilliant. I am logging in automatically to devices I have logged in to before. Is there a way to do that with new devices (e.g. putting the account info in the URL)?

  43. sam
    March 20th, 2015 at 16:52 | #43

    Can we pass user name and password over the link to allow automated login?

  44. Morten
    August 10th, 2015 at 14:14 | #44

    Hi Scott,

    Links not working anymore.

    Please share TeamViewer Hyperlinks file and DameWare Hyperlinks file Again, thanks.

    Best regards

  45. Arno Nym
    November 20th, 2015 at 10:06 | #45

    Your code would be more portable if you would use %windir% instead of C:\windows

  46. prabhjot
    November 20th, 2015 at 13:13 | #46

    I have tried this script. this works fine with Internet explorer but google chrome is not recognizing this. Please help.

    Thanks in Advance

  47. Dulcie
    October 7th, 2016 at 07:47 | #47

    How do I use this rdp:// in wordpress, it doesn't save when I type it in.

  48. Dave Goldschmidt
    January 4th, 2017 at 21:43 | #48

    I was wondering if you had figured out how to automate login to rdp with a username /password string. I could use this in a couple of things I am working on.
    Thanks in advance.

  49. Megan
    June 26th, 2017 at 22:33 | #49

    Thank you, very useful

  50. Zuke
    August 23rd, 2017 at 22:36 | #50

    I just found this and it is AWESOME! Edge doesn't like it, but IE11 does.

    We have a conference room that people want to use to present their desktops back at their desk. My plan is to make a locally served webpage on a thinclient that is always up. When they log into the webpage, it takes their username and finds which machine they are logged into on the floor (still working that part out) and when they click on it, it launches the RDP link that this provides. The only way it could be better is if it could pass on username/password arguments.

    Any luck with that?

  51. Dave
    July 10th, 2018 at 22:35 | #51

    Just found this and it works even in Windows 10, just have to run the batch file from an administrative command line. This did the trick to allow me to put links to my servers in the spreadsheet I use to keep up with them. (yeah, I know that's the 1990's way to do it...). Thanks a ton.

  52. Pabru
    January 15th, 2019 at 14:32 | #52


    Just a heads up, I've cleaned up the code a little (I think), and added it to my Windows setup database thing. You can find it over at htt ps:// github. com/pabru/SysadminStuff/blob/master/Windows%20customisation/Add%20support%20for%20RDP%20URLs.md if you wish.

    I might even use this for other protocol handlers in the future, I didn't even know you could do that. Thanks a lot ๐Ÿ™‚

  53. Steve Turgeon
    March 22nd, 2019 at 19:43 | #53

    This is a great solution!

    But, I wanted to implement the username feature without installing any additional software (like Zenoss) so I renamed the hyperlink-rdp.js to hyperlink-rdp.vbs and replaced the content with:

    With WScript.CreateObject("WScript.Shell")
    URL = Unescape(Replace(Replace(WScript.Arguments(0), "rdp://", "", 1, -1, 1), "/", ""))
    If uBound(Split(URL, ",")) > 0 Then
    .RegWrite "HKCU\Software\Microsoft\Terminal Server Client\Servers\" & Split(URL, ",")(0) & "\UsernameHint", Split(URL, ",")(1), "REG_SZ"
    End If
    .Exec "mstsc /v:" & Split(URL, ",")(0)
    End With

    You'll need to run this command to point to the new script:

    reg add "HKCR\rdp\shell\open\command" /f /v "" /t REG_SZ /d "wscript.exe C:\WINDOWS\hyperlink-rdp.vbs %%1"

    Now, "rdp://someserver/Username" works.

    Feel free to steal this solution and add it to your code.

  54. Steve Turgeon
    March 22nd, 2019 at 19:52 | #54

    @Steve Turgeon

    Sorry, link should be "rdp://someserver,Username"