Remote App: The Last Whish

Remote App: The Last Whish

In one of my older blogs, I was talking a lot about how and why you don’t always need to go hybrid (HAADJ). I also showed you the kind of problems you could run into. This blog will show you how to make sure your old legacy apps (which are configured as Remote Apps) can be easily deployed to your AADJ devices, so you won’t need the go Hybrid 😛

Please read my blog about HAADJ before you continue…pretty please with sugar on top

If you have been reading the blog above, you will probably have read that when a customer only has one or two legacy apps left that can’t be migrated, it can be hard to transform to a modern workplace. So what are we going to do?

As told in that blog, you could create a Remote App and publish it to your client’s devices. But how are we going to implement this? I guess there isn’t any real good documentation that people could use. I have been getting this question often. So here we go!

You have got 3 options here

  1. Configure the connection URL
  2. PowerShell User based script
  3. Download the RDP and deploy it with a Win32 App
  4. Combine A Option 2 and 3 🙂

Option 1. Configure the connection URL

The only thing to configure this is creating a settings catalog profile. So open Intune and create a new settings catalog and search for “remoteapp and desktop connections”

Afbeelding met tekst  Automatisch gegenereerde beschrijving

You can define the connection URL: https://portal.company.nl/RDWeb/Feedlogin/WebFeedLogin.aspx

But this policy will only work when your devices have the Windows Insider build… and I guess deploying the insider build to all your production devices could be a little bit too much.

UPDATE 04-09-2021

Fantastic news! Finally, 1400 settings which were only available to the insider preview in the past are now available and ready to be implemented!

Now go install this Windows 10, version 21H1 Build 19043.1200 also known as KB5005101!!

Option 2. PowerShell User Based Script

The second option we have is to use a PowerShell script and deploy it to our devices in Intune. Only 2 prerequisites to note.

1.PowerShell must be enabled for your users ☹

2.You will need to be in the same domain as the RDWeb to work…

But looking at the information we have about SSO with AADJ devices to our on-premise environment I guess this would be no problem!

The powerShell script itself (Needs to be user-targeted and not to be run as system!)

$url = "https://portal.company.nl/RDWeb/Feed/WebFeed.aspx"

#Construct the XML file
$XML = @"
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<workspace name="Company Remote Access" xmlns="http://schemas.microsoft.com/ts/2008/09/tswcx" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<defaultFeed url="$URL" />
</workspace>
"@

#WCX file path.
$Directory = "c:\webfeed\"
$WCX = "webfeed.wcx";
$FullPath = ($Directory + $WCX);

#New folder.
New-Item $Directory -Type Directory -Force | Out-Null;

#Export the file.
$XML | Out-File -FilePath $FullPath -Encoding utf8 -Force | Out-Null;

#Add the web feed.
Start-Process -FilePath rundll32.exe -ArgumentList 'tsworkspace,WorkspaceSilentSetup',$($WCX).ToString() -Wait -NoNewWindow;

Please note: the example, I am using: portal.company.nl isn’t going to work as it has no valid certificate!

Afbeelding met tekst  Automatisch gegenereerde beschrijving

So please use your own valid RDWeb when you want to test out the script!

Now let’s test it on an AADJ joined device. Please make sure to test if you can download the webfeed.aspx. If it ain’t working at the first attempt try to add the RDWeb page to your local intranet site and make sure you have enabled the automatic logon verification

Afbeelding met tekst, binnen, schermafbeelding  Automatisch gegenereerde beschrijving

(of course, this can be done with a nice PowerShell script)

Now let’s fire up the PowerShell script and watch what happens

Afbeelding met tekst  Automatisch gegenereerde beschrijving

The RemoteApps are also added to your start menu

Option 3. Download the RDP and deploy it with an Win32 App

Now for the third and last option we have. Please make sure you have Installed chrome… (yeah I know… not Edge this time)

When chrome is installed browse to your RDWeb page like https://portal.company.nl/rdweb

When clicking/opening the remote app it will also download that file to your device…. And that’s exactly what you need!

Now create a new folder and place that RDP file in it and rename it to remoteapp.rdp. And if you want to make the shortcut look a little bit nicer make sure you have the ICO from the remote app and place it in the same folder

Now we have the basics in place… let’s create a simple PowerShell script and give it the name: installremoteapp.ps1

md "c:\program files (x86)\rdp"
copy .\rdp.ico "c:\program files (x86)\rdp\rdp.ico"
copy .\remoteapp.rdp "c:\program files (x86)\rdp\remoteapp.rdp"

#Create Shortcut Desktops
if (-not (Test-Path "C:\Users\Public\Desktop\RemoteApp.url"))
{
$null = $WshShell = New-Object -comObject WScript.Shell
$path = "C:\Users\Public\Desktop\RemoteApp.url"
$targetpath = "c:\program files (x86)\rdp\remoteapp.rdp"
$iconlocation = "c:\program files (x86)\rdp\rdp.ico"
$iconfile = "IconFile=" + $iconlocation
$Shortcut = $WshShell.CreateShortcut($path)
$Shortcut.TargetPath = $targetpath
$Shortcut.Save()

Add-Content $path "HotKey=0"
Add-Content $path "$iconfile"
Add-Content $path "IconIndex=0"
}

Looking at the script, it will first create a new folder in the program files (x86) and it will copy the 2 files (RDP and ICO) to this folder. After it has copied the 2 files it will start creating a new shortcut on the public (all users) desktop folder with the name RemoteApp.

The shortcut will be targeted to the RDP file in the program files and it will attach that nice ICO to it!. Please make sure you define the shortcut $path as.URL otherwise the ICO will not work

Now just create an intunewin file from it and deploy it to Intune.

Install: powershell -ex bypass -file installremoteapp.ps1

Detection rule: File Exist C:\program files (x86) Folder: RDP

When you have deployed this app to Intune, on all your devices you targeted a new nice RDP icon will be available!

4.Combine Options 2 and 3 🙂

A whole other approach could be to combine options 2 and 3. Just like I said, you will first need to take a look at the RDP file itself.

As shown in option 3, you can do so by download the RDP itself and open it with notepad…yeah notepad and copy the whole content

Now create a new PowerShell script like shown below and paste your content between the @” “@

$targetdir = "c:\program files\REMOTEAPP"
New-Item -ItemType "directory" -Path $targetdir -Force

### REMOTEAPP

$rdpFile=@"
Content of the RDP FILE
"@

$rdpFile | Out-File "$targetdir\RemoteApp.rdp"
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("c:\users\public\Desktop\RemoteApp.lnk")
$Shortcut.TargetPath = "$targetdir\RemoteApp.rdp"
$Shortcut.Save()

And upload this PowerShell script to Intune… Please note, this PowerShell script must be configured to be run as System!

Conclusion:

Moving away from your on-premise environment would mean you need to come up with a solution for your legacy apps. Creating and deploying a RemoteApp for this could be your solution.

I hope this blog showed you which options you have and how to implement them! Now pretty please move away from your on-premise environment to AADJ as soon as you can

Universal Pictures Home Entertainment GIFs - Find & Share on GIPHY

6 thoughts on “Remote App: The Last Whish

  1. Couldn’t get the install to work with “Install: powershell.exe -executionpolicy bypass -command “& ‘.\installremoteapp.ps1””

    Changed to “PowerShell.exe -ExecutionPolicy Bypass -file installremoteapp.ps1”

    1. Hi, I noticed the same… I copied the install command i used while testing it in sandbox powershell session. I changed it and added also option 4..

  2. In my environment the script creates the WCX file but does not install it. If I launch the wcx file manually I have to type my credentials and it works, I presume that is the issue.

    1. Hi, are the users in the same domain/ or aadj with ad connect installed? you also need to change the intranet website to automatically logon with the user id when the website is in the list of local intranet websites.

    1. Hi, thats true about 1400 insider previeuws are now available without insider previeuw version… but you will need to make sure your devices are up to date and have this update installed:
      KB5005101

Leave a Reply

Your email address will not be published. Required fields are marked *

16  +    =  19