Windows Server 2012 : Selected server has pending reboots and does not clear when rebooted

For a while I thought the role is already installed, but that's only one of dozens of obvious checks that the RDS/TS Deployment features in WS2012 do not do properly. If you get part way through the RDS deployment and it bails out due to an error, you will be stuck here.

My RDS role was partially installed, but not installed enough that you can confirm a role deployment from powershell, with the following command:

PS C:\Users\myname > get-RDLicenseConfiguration
get-RDLicenseConfiguration : A Remote Desktop Services deployment does not exist on servername.domain.local. This
operation can be performed after creating a deployment. For information about creating a deployment, run "Get-Help
Set-VDIDeployment" or "Get-Help Set-RDSHDeployment".
At line:1 char:1
+ get-RDLicenseConfiguration
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-RDLicenseConfiguration

Here are the problems in the order that I hit them, and how I ended up thinking I was stuck where I thought I was stuck above: Trying to deploy the RDS role appears blocked on a reboot when the real problem is that the RDS role is already mostly installed, although one or more role services are not. In other words, when a feature that a normal human being wants to deploy on a computer is composed of so many little "tiny installable bits" and some are installed, and some are not, you get into a state that they did not plan for or test for. This is one of those states.

FIX PART 1:

There is a registry key that is >0 when the system needs a reboot. It was NOT getting cleared.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerManager

Look for key named CurrentRebootAttempts and if >0 then change to zero.

Second half of the problem has to do with the Remote Desktop licensing system has a Grace Period, a way of getting you out of the box and up and running without exposing you to one of Microsoft's worst and most annoying licensing systems ever (RDS licensing), when this Grace Period ends, and licensing is properly configured, Microsoft's own tools are supposed to delete a registry key that says "Grace Period". However, Microsoft's own people have configured that registry key so that it has permissions that not even Microsoft's tools can overcome, it cannot be deleted, in short, and you end up stuck where I'm stuck. It looks like Licensing services were not installed, licensing modes were not configured, and licensing roles were not deployed, when in fact they were, and the real problem is that Microsoft's product (Windows Server 2012) is broken, and is lying to you.

FIX PART 2:

Deploy RDS licensing from powershell, run powershell as Administrator, and type, obviously changing servername.domain.local to your own FQDN:

import-module RemoteDesktop
New-SessionDeployment -ConnectionBroker servername.domain.local

When prompted, answer values shown here:

Supply values for the following parameters: - WebAccessServer: servername.domain.local - SessionHost[0]: servername.domain.local - SessionHost[1]: (press enter, but don't type anything here)

Finally, run Get-RDLicenseConfiguration and if not configured, use this command to configure licensing mode:

Set-RDLicenseConfiguration -LicenseServer host.domain.local  -Mode PerUser -ConnectionBroker host.domain.local