“Remote Desktop Links” Custom List in Office365

I have a lot of servers that I connect to using remote desktop. Windows only remembers the last 10 servers to which you connected. There are some 3rd party applications that manage your connections, but I wanted to use Sharepoint and not install another local application.

I wanted to use a Sharepoint list to store and manage my Remote Desktop Connections. I also wanted to be able to click on a hyperlink to open the connection.

There are several obstacles to this goal:

  1. There is no protocol for opening Remote Desktop Connections via a URL.
  2. Even if there was Sharepoint won’t let you use it. It will only allow http:// or https:// in a hyperlink column.
  3. The hyperlink column doesn’t give you the option of launching the link in a new window.

If I were using an on premise Sharepoint implementation I might consider creating a custom column, but I want this to work in Office365.

Creating a rdp:// URL Protocol

This will need a Registry tweak to add a new url protocol to mstsc.exe. Here is a reg file which will update the Registry with the new rdp:// protocol.

Windows Registry Editor Version 5.00
HKEY_CLASSES_ROOT\rdp]@="URL:Remote Desktop Connection" "URL Protocol"=""
HKEY_CLASSES_ROOT\rdp\DefaultIcon]@="C:\\WINDOWS\\System32\\mstsc.exe"
HKEY_CLASSES_ROOT\rdp\shell]
HKEY_CLASSES_ROOT\rdp\shell\open]
HKEY_CLASSES_ROOT\rdp\shell\open\command]@="cmd /V:ON /s /c set url=%1 && set url=!url:rdp:=! && set url=!url:/=! && start C:\\WINDOWS\\system32\\mstsc.exe /v:!url!"

Once you’ve updated your registry you will be able to create url links like this one which, when opened will launch a new Remote Desktop Connection to the server:

rdp://server

Save the above into a file called Remote Desktop Protocol.reg. The idea is to make this reg file available through the Sharepoint site for first time users who don’t have it. There is a problem in that because you won’t be able to upload a reg file to the Site Assets library, so I suggest adding it to a Remote Desktop Protocol.zip file first.

Create a redirect page

Sharepoint won’t let us use our new rdp:// protocol in a hyperlink column, so to get around this limitation we need to create a redirect page we can use in a hyperlink column and pass it the link we really want to open in the query string.

Open up your site in Sharepoint Designer. Select All Files under Site Objects, click the File button on the Ribbon and choose to create a new ASPX file.

Name the file redirect.aspx and copy in the markup below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
   <meta name="WebPartPageExpansion" content="full" />
    <title>Remote Desktop</title>
 </head>
 <body>
    <script type="text/javascript">
      window.open(window.location.search.substring(1));
      window.history.back()
    </script>
  </body>
</html>

Create the Custom List

Open up your site and create a new Custom List and add a new hyperlink column to it.

Create a new list item and enter the following in the Hyperlink Url:

https://companyweb.sharepoint.com/site/redirect.aspx?rdp://server

If you have applied the registry tweak, when you open the link you should see a new Remote Desktop Connection open up.

Finally, I edited the default page and added some text along with a link to the Remote Desktop Protocol.zip file which I added to the Site Assets library. I also added a List Web Part to display a customised view of just the hyperlink column from my Custom List.  Here’s what it looks like:

4 comments:

Mike Shugar said...

Thank you. Been looking for a long time. This is the only solution I found that works.

Dan Andrews said...

Just FYI, I changed your redirect script so that it removed the orphaned window:

var win=window.open(window.location.search.substring(1), '_blank');
win.focus();
setTimeout(function(){win.close();window.history.back();},500);

Anonymous said...

Hi Ian,

Thank you very much for your post, this is I think exactly what I need. I'm trying this on a Windows 7 box. My problem is that the .reg file completes without errors, but I can't see the new rdp entry in the HKEY_CLASSES_ROOT registry section afterwards, nor is the new rdp protocol listed in the Control Panel. I am logged in as admin on the Windows 7 box. What could I be doing wrong?

ShawnM said...

Thank you for the good article.
I am always pleased to read useful and interesting information. By the way, I have recently heard about data room software that opens new opportunities for business.