- PowerShell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| Changelog.md | ||
| Get-RDSLicenseStatus.ps1 | ||
| Readme.md | ||
Get-RDSLicenseStatus
Reports three things, one line each: RDS licensing grace period days left, the RD Licensing server, and how many days are left on each installed license pack. Nothing else, nothing written anywhere except the log file.
Run
.\Get-RDSLicenseStatus.ps1
# or target a specific license server:
.\Get-RDSLicenseStatus.ps1 -LicenseServerName 'RDS-LIC01'
Works the same from PowerShell ISE, console, or NinjaOne ($env:licenseServerName as script variable). ISE: the script prints the exit code instead of calling exit, which would otherwise close the ISE session.
Auto-discovery
Leave -LicenseServerName empty and the script asks the local RD Session Host which license server it's configured to use (GetSpecifiedLicenseServerList), then queries that one. Win32_TSLicenseKeyPack only exists on a machine with the RD Licensing role - pointing it at a Session Host gives a clear error instead of a bare WMI failure.
Log
C:\Windows\Temp\Get-RDSLicenseStatus.log.
Exit codes
0 = at least one reading succeeded. 1 = both failed.
Notes
- Licensing type (Per Device / Per User) isn't reported -
GetLicensingType()is missing on some OS builds (confirmed absent on Server 2022/2025). - Grace period
0days isn't proof of a problem by itself - it also reads0once a license server is actively issuing CALs. Check the license pack line(s) above it.