Can Remote Desktop Services be deployed and administered by PowerShell alone, without a Domain in WIndows Server 2012 and 2012 R2? YES!!

Here we go:

  1. Install the Remote Desktop Licensing and the Remote Desktop Session Host role services using the following steps:
    • Open Server Manager
    • Click on Manage and select Add Roles and Features
    • Select Role-based or Feature-based installation
    • Under Remote Desktop Services, choose Remote Desktop Licensing and Remote Desktop Session Host role services.
    • Proceed with installation
  2. Add the License Server to Terminal Server License Servers group and restart the Remote Desktop service (you can use licmgr.exe)
  3. Add the licenses to the license server.
  4. Configure the Remote Desktop Session Host role with to use the local Remote Desktop Licensing server. Follow these steps:
    • Open PowerShell as administrator
    • Type the following command on the PS prompt and press Enter:

$obj = gwmi -namespace "Root/CIMV2/TerminalServices" Win32_TerminalServiceSetting

Run the following command to set the licensing mode (Note: Value = 2 for Per device, Value = 4 for Per User, we use per-user)

$obj.ChangeMode(4)

Run the following command to replace the machine name with License Server (mylicenseserver is the name of your server):

$obj.SetSpecifiedLicenseServerList("mylicenseserver")

Run the following command to verify the settings that are configured using above mentioned steps:

$obj.GetSpecifiedLicenseServerList()

You should see the server name in the output.

Once done this, reboot the system and log in with any user (if using a workgroup, you know your users must be part of the Remote Desktop Users) and the trial period message will dissapear.

Source of all this mess: http://support.microsoft.com/kb/2833839

Managing with Powershell

There are a few things you can manage with Powershell. To see the commands try:

import-module RemoteDesktop get-command -module RemoteDesktop

There is a list of commands you can execute via Powershell to manage your box. However, I’ve tried a few but some of them require you to have some extra features installed, that can’t be deployed on the scenario we are talking about.

The ugly way

If none of the above works for you, there is a way to reset the grace period to the initial 120 days. Of course, I don’t recommend doing this, as the user will keep noticing the message. Of course, you’ll need to purchase proper licenses.

To reset the counter, just delete this registry key:

HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\Grace Period

Of course, you’ll need extra-privileges to do that, executing regedit as administrator will not work. Try this:

  • Get PSEXEC
  • Start a cmd as administrator
  • run psexec -s -i regedit.exe
  • delete the desired key
  • reboot

Hope some of this works for you. If you do some advances with Powershell and RDS, let us know.

Source: http://serverfault.com/questions/541870/can-remote-desktop-services-be-deployed-and-administered-by-powershell-alone-wi

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s