Share via


Managing Remote Apps using PowerShell on Windows Server 2012

In this Wiki, we will perform actions related to RemoteApps in Windows Server 2012 by making use of PowerShell including, but not limited to:

  • Creating RemoteApps
  • Creating Subfolders
  • Setting File Extensions

(More Wiki's on the RemoteDesktop PowerShell module in Windows Server 2012: http://social.technet.microsoft.com/wiki/contents/articles/12835.using-powershell-to-install-configure-and-maintain-rds-in-windows-server-2012.aspx *)
*

Creating RemoteApps

The RemoteDesktop PowerShell module also has the ability to create, update and delete RemoteApps. There is a PowerShell command to retrieve RemoteApps and their properties from a specified Collection and RD Connection Broker. This cmdlet is Get-RDRemoteApp. For example to retrieve all RemoteApps the following command can be used.

http://www.virtualizationadmin.com/img/upl/image0111342120105777.png

The command to create a new RemoteApp is New-RDRemoteApp.

*SYNTAX
*

    New-RDRemoteApp [-CollectionName] <string> -DisplayName <string> -FilePath <string> [-Alias <string>]<br>    [-FileVirtualPath <string>] [-ShowInWebAccess <bool>] [-FolderName <string>] [-CommandLineSetting<br>    <CommandLineSettingValue> {DoNotAllow | Allow | Require}] [-RequiredCommandLine <string>] [-UserGroups <string[]>]<br>    [-IconPath <string>] [-IconIndex <string>] [-ConnectionBroker <string>]  [<CommonParameters>]

In this example, we create a RemoteApp to deliver WordPad. We use the following command;

new-rdremoteapp -Alias Wordpad -DisplayName WordPad -FilePath "C:\Program Files\Windows NT\Accessories\wordpad.exe" -ShowInWebAccess 1 -collectionname MySessionCollection -ConnectionBroker LS01.CRFB.Local

During the creation of the RemoteApp we are provided with a progress bar.

http://www.virtualizationadmin.com/img/upl/image0121342120105792.png

In addition, when the creation is finished to command output the details of the creation.

http://www.virtualizationadmin.com/img/upl/image0131342120161402.png

When we refresh the Server Manager console we see the RemoteApp successfully added.
http://www.virtualizationadmin.com/img/upl/image0141342120161418.png
The RemoteDesktop module also supplies cmdlets to update RemoteApps (Set-RDRemoteApp) and remove RemoteApps (Remove-RDRemoteApp).

When you create a new RemoteApp using the GUI wizard it would also show a list of available applications that can be added. The equivalent PowerShell Command for this action is Get-RDAvailableApp. Running this command while specifying the connection broker and collection can result in an output as follows:

http://www.virtualizationadmin.com/img/upl/image0151342120161418.png

Creating Subfolders

Using the RemoteDesktop PowerShell module we're also able to add subfolders in RD Web Access and "move" specific Remote Apps to specific folders. In order to do so we use the same command as above, Set-RDRemoteApp. For example, to create a subfolder called "My Favorite tools" and move the Remote App Wordpad to that folder you can use the following command:

*Set-RDRemoteApp -CollectionName MySessionCollection -Alias Calculator -FolderName "My Favorite tools" -ConnectionBroker SH01.CRFB.Local

*Note that you need to specify the name of the Session Collection as well as the name of the RD Connection Broker server.

Creating File Extensions

A common setting is configuring the file extensions for Remote Apps. Inside the ServerManager GUI, file extensions are configured as a property of a RemoteApp, therefore you would expect that setting a file extension using PowerShell should be done using the command Set-RDRemoteApp. Instead, we need to use a different command called Set-RDFileTypeAssociation.

SYNTAX
 

<p>   Set-RDFileTypeAssociation [-CollectionName] <string> -AppAlias <string> -FileExtension <string> -IsPublished<br>    <bool> [-IconPath <string>] [-IconIndex <string>] [-ConnectionBroker <string>]  [<CommonParameters>]</p>
<p>    Set-RDFileTypeAssociation [-CollectionName] <string> -AppAlias <string> -FileExtension <string> -IsPublished<br>    <bool> -VirtualDesktopName <string> [-IconPath <string>] [-IconIndex <string>] [-ConnectionBroker <string>]<br>    [<CommonParameters>]</p>

For example, if we want to add the file extension .pdf to a Remote App Acrobat Reader we can use the following command:

*Set-RDFileTypeAssociation -CollectionName MySessionCollection -AppAlias AcrobatReader -FileExtension .pdf -IsPublished $true -ConnectionBroker SH01.CRFB.Local
*


References

See Also