Windows Server 2012 / 2012 R2 - RDS - Publish RemoteApp programs (from the command line - CLI)

Page 1 / 1

Previously, we explained how to publish RemoteApp programs on your RDS infrastructure through the server manager.
Nevertheless, for those who would like to automate the installation of RemoteApp programs and their publications, here is how to do it via the command line (cmd + powershell).

  1. Install RemoteApp programs from the command line
  2. Publishing RemoteApp programs through PowerShell

1. Install RemoteApp programs from the command line

To install RemoteApp programs on a session host server, you must first switch your server to "installation" mode.

Indeed, by default, the server is in "Execute" mode.
To check it, just use this command :

Batch

change user /query

Plain Text

User session is ready to execute applications.

Then, to switch your server to "Install" mode, type this command :

Batch

change user /install

Plain Text

User session is ready to install applications.

Now, you can install whatever you want from this command prompt or through the GUI.

Once you're done, you'll be able to switch your server back to Execute mode.

Batch

change user /execute

Plain Text

User session is ready to execute applications.

2. Publishing RemoteApp programs through PowerShell

Finally, to publish your RemoteApp programs, create the necessary collection (s) through the GUI, and open a PowerShell command prompt.
In this PowerShell prompt, first import the "RemoteDesktop" module.

PowerShell

Import-Module RemoteDesktop

Then, rely on this powershell command to publish them :

PowerShell

New-RDRemoteApp -Alias [the program name without space] -DisplayName "[display name]" -FilePath "[full path of the file to launch]" -ShowInWebAccess 1 -CollectionName [collection name] -ConnectionBroker [broker server FQDN]

Which gives in our case :

PowerShell

New-RDRemoteApp -Alias EXCEL -DisplayName "Excel 2013" -FilePath "C:\Program Files\Microsoft Office\Office15\EXCEL.exe" -ShowInWebAccess 1 -CollectionName Office -ConnectionBroker rds.informatiweb.lan

When you run this command, the "Publish RemoteApp program" message will appear temporarily in the PowerShell console.

Then, this :

Plain Text

CollectionName Alias          DisplayName              FilePath                         ShowIn CommandLin RequiredC Use
                                                                                        WebAcc eSetting   ommandLin rGr
                                                                                        ess               e         oup
                                                                                                                    s
-------------- -----          -----------              --------                         ------ ---------- --------- ---
Office         EXCEL          Excel 2013               C:\Program Files\Microsoft Of... True   DoNotAllow

Once the program(s) are published, you will find them in the collection in which you published them.

And you can also change their properties later, if you wish.