No description
  • PowerShell 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-18 11:41:15 +02:00
Changelog.md Add Changelog.md 2026-08-18 11:40:50 +02:00
Get-RDSLicenseStatus.ps1 Add Get-RDSLicenseStatus.ps1 2026-08-18 11:41:15 +02:00
Readme.md Add Readme.md 2026-08-18 11:40:34 +02:00

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 0 days isn't proof of a problem by itself - it also reads 0 once a license server is actively issuing CALs. Check the license pack line(s) above it.