[Aug. 2010: Updated instructions for starting PowerShell in the RDS context]
In Windows Server® 2008 R2, we introduced the Remote Desktop Services Provider for Windows PowerShell™. This post gives examples of how you can use this new feature to manage Remote Desktop Licensing (RD Licensing).
This post assumes that you have a basic understanding of Windows PowerShell. As you might already know, Windows PowerShell provides an easy scripting interface for performing administrative tasks. You can write Windows PowerShell scripts to automate the setup deployment per your requirements.
· Install the required Remote Desktop Services feature (that is, Remote Desktop Licensing for Example 1 and Remote Desktop Session Host for Example 2).
· Start the Windows PowerShell command window and switch to RDS context:
After you do this, you will see a Windows PowerShell window with the prompt set to the RDS drive.
Following are two examples for configuring a server with Windows PowerShell:
Note: When using Powershell commands, make sure that you execute them from the correct path. First cd to the correct directory before executing the command.
1. On the Remote Desktop license server:
a. Activate the license server using the Automatic Connection method with the following command:
PS RDS:\LicenseServer> Set-Item .\ActivationStatus -Value 1 -ConnectionMethod AUTO -Reason [Reason]
where [Reason] specifies the reason for activation of the license server. It has 6 possible values:
0 - The server was redeployed
1 - The certificate was corrupt
2 - The private key was compromised
3 - The activation key expired
4 - The server was upgraded
5 - The server is being activated for the first time
b. Install the Select License Key Pack by using the following command:
PS RDS:\LicenseServer\LicenseKeyPacks> New-Item -path RDS:\LicenseServer\LicenseKeyPacks -InstallOption INSTALL -ConnectionMethod AUTO -LicenseType AGREEMENT -AGREEMENTTYPE 0 -AGREEMENTNUMBER [AgreementNumber] -PRODUCTVERSION [ProductVersion] -PRODUCTTYPE [ProductType] -LICENSECOUNT [LicenseCount] where [AgreementNumber] refers to the Agreement Number for the licenses, [ProductVersion] refers to the version of the licenses. It has three possible values:
0 - Windows 2000 Server
1 - Windows Server 2003
2 - Windows Server 2008 or Windows Server 2008 R2
[ProductType] refers to the type of license. It has four possible values:
0 - for Per Device
1 - for Per User
4 - for VDI Standard
5 - for VDI Premium, and
[LicenseCount] refers to the number of licenses that you want to install.
c. Add the license server to the Terminal Server License Servers group on the domain controller by using the following command:
PS RDS:\LicenseServer> Set-Item .\LSinTSLSGroup -Value 1
Note: To run this command, you need to have Enterprise Admin privileges.
d. Query to see if the license server is registered in Service Connection Point (SCP) by using the following command:
PS RDS:\LicenseServer> Get-Item .\SCPRegistrationStatus
This command will show the current value, permissible values, and the permissible operations for the property. If the value of ‘SCPRegistrationStatus’ property is set to 1, it means that the license server is already registered in SCP.
e. Generate the Per User license usage report by using the following command:
PS RDS:\LicenseServer\IssuedLicenses\PerUserLicenseReports> New-Item -Name [NameOfReport] -Scope [Scope]
where [NameOfReport] is the name with which you want to refer to the report, and [Scope] represents the scope of the report. It can have three values:
DOM - Generate a report for the entire domain
ALLTRUSTEDDOM - Generate a report for all trusted domains
OU - Generate a report for the organizational unit (OU)
2. On the Remote Desktop Session Host (RD Session Host) server:
a. Specify the licensing mode on the RD Session Host server using the following command:
PS RDS:\RDSConfiguration\LicensingSettings> Set-Item .\LicensingType -Value [Type]
where, the possible values of [Type] are:
2 - Per Device
4 - Per User
b. In the Specified License Server list, add the license server name by using the following command:
PS RDS:\RDSConfiguration\LicensingSettings\SpecifiedLicenseServers> New-Item -Name [LSName]
where [LSName] refers to the name of the license server.
For more information about licensing and Windows PowerShell, use these commands: cd, dir, and Get-Help.
My understanding is that
1) the only thing that the RDS license manager "oversees" is Session Host (Terminal Services), not the other RDS components (Virtualization Host, Gateway, Connection Broker)
2) VDI Standard does NOT license the right to access Session Host
And yet, "VDI Standard" is one of the choices for "type of license" in the post...
Could you help me understand? Thanks
I must be blind... because I have no option for Remote Desktop Services module for Windows PowerShell
The post is a bit outdated. The shortcut is not available at the mentioned location. However, you can launch windows powershell as 'administrator' and issue, the below mentioned commands:
Command 1: Import-Module RemoteDesktopServices
Command 2: cd RDS:\
Doing so, will set the drive to 'RDS:'
where can I found the ConnectionMethod from the bellow line :
Set-Item .\ActivationStatus -Value 1 -ConnectionMethod AUTO -Reason [Reason]
I am trying to automate generating a PerUserLicenseReport and email it off to management. I can run the New-Item cmdlet, but regardless of the -Name parameter I specify, it defaults to the data_time. Also, I am unable to Move-Item or Copy-Item because we are in the ADRMS provider, and not the file system.
Is there a way to automate this task?
Cannot bind parameter 'ProductType'. Cannot validate argument "5" because it does not belong to the set "0,1,2,3"
I spend a lot of time to find Remote Desktop Services module for Windows PowerShell in my computer.
its helped me a lot, can you please clarify how to add license server.