Microsoft provides a graphical user interface and a command-line interface to help with virtual desktop deployment.
Now that you have installed Remote Desktop Services on Windows 2008 R2, see how to manage it with Windows PowerShell.
The management interface installed with the Remote Desktop Services (RDS) PowerShell module is made up of two parts:
Providers present a logical view of a data structure (similar to a file system) with a tree structure (like that of the graphical user interface) for dealing with RDS. Providers also make use of common cmdlets like get-item, get-childitem, get-acl, set-acl and new-item>. Microsoft provides more information about providers on its website.
Cmdlets in relation to RDS, provide management that may be out of the scope of the provider.
Step 1: Install Remote Desktop Services Management
The first step is simple -- in fact, you don't need to do anything at all.
The provider and cmdlets are installed by default with the RDS components.
Step 2: Run the PowerShell RDS module
There are two options for starting the PowerShell RDS Module:
Go to Start Menu -- All Programs -- Administrative Tools -- Remote Desktop Services - - Remote Desktop Services PowerShell.
Add the module to an existing PowerShell module by the Import-Module cmdlet built-in to PowerShell (see Figure 1).
Import-module RemoteDesktopServices -- verbose.
Note: Unless User Account Control is disabled, you will want to "Run as Administrator."
Step 3: Take a look at what you have
The biggest obstacle when starting is figuring out what you have. There are several ways to do this, including get-command and default provider cmdlets.
Get-command is a built-in cmdlet that notes what commands are available. One of the most useful parameters for get-command is –module, gets the commands available in the module.
Take a look at the cmdlets provided by RDS Module in Figure 2.
Note: For more information on get-command see get-help get-command -- full or the Microsoft help page on get-command.
Default Provider cmdlets
There are many built-in provider cmdlets designed to work consistently with all the providers (such as registry, file system and RDS).
Get-Childitem (dir:) Gets all the child items in the current location.
Example: PS> get-childitem RDS:\ConnectionBroker
Get-Item (gi:) Gets a specific item in the provider.
Example: PS> get-item RDS:\ConnectionBroker\DisplayName
Get-Member (gm:) Lists the properties for a given item.
Example: PS> get-item RDS:\ConnectionBroker\DisplayName | get-member
Set-item: Used to set a property on a given item.
Example: PS> get-item RDS:\ConnectionBroker\DisplayName | set-item -value "RDS CB"
Overall, PowerShell is a powerful tool for managing Remote Desktop Services. For more information on virtual desktop deployment, check out Microsoft'sRemote Desktop Services Team Blog.
ABOUT THE AUTHOR:
Brandon Shell has been in the IT industry since 1994. He started out as a PC tech and general fix-it guy for numerous companies. In 2000, Shell joined Microsoft as contractor for the Directory Services team, and he became a full-time employee in 2002. In 2004, Shell left Microsoft to pursue a new position focusing on his real passion, PowerShell. In 2007, he joined the PowerShell MVP ranks, and Shell has spent the past several years building his PowerShell knowledge and helping others build theirs.