Home / XenApp & XenDesktop / Få RDS-CAL statistikk med PowerShell

Få RDS-CAL statistikk med PowerShell

Lite Powershell script for å hente statistikk til dine RDS-CAL-lisenser.

Krav

  • Powershell v2 installert
  • Kjør skriptet på serveren der RDS Licensing Manager er installert

Script:

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Filename of the export
$filename = «RDS-CAL-Report.csv»
# Import RDS PowerShell Module
import-module remotedesktopservices
# Open RDS Location
Set-Location -path rds:
# Remove previous reports (Optional)
remove-item RDS:\LicenseServer\IssuedLicenses\PerUserLicenseReports\* -Recurse
# Create new RDS report
$NewReport = new-item -path RDS:\LicenseServer\IssuedLicenses\PerUserLicenseReports -Scope DOM -Name Report
# Name is automatically generated
$NewReportName = $NewReport.name
# Get issued licenses
$IssuedLicenseCount = get-item RDS:\LicenseServer\IssuedLicenses\PerUserLicenseReports\$NewReportName\Win2K8-Win2K8R2\IssuedCount
# Count issued licenses
$IssuedLicenseCountValue = $IssuedLicenseCount.CurrentValue
# Get installed licenses
$InstalledLicenseCount = get-item RDS:\LicenseServer\IssuedLicenses\PerUserLicenseReports\$NewReportName\Win2K8-Win2K8R2\InstalledCount
# Count installed licenses
$InstalledLicenseCountValue = $InstalledLicenseCount.CurrentValue
# Installed – Issued
$Available = $InstalledLicenseCount.CurrentValue $IssuedLicenseCount.CurrentValue
# Show percentage available
$AvailablePercent = ($Available /$InstalledLicenseCount.CurrentValue)*100
$AvailablePercent = «{0:N0}» -f $AvailablePercent
# Display info
Write-host «Installed: $InstalledLicenseCountValue»
Write-host «Issued: $IssuedLicenseCountValue»
Write-host «Available: $Available [ $AvailablePercent % ]»
# Add the information into an Array
[System.Collections.ArrayList]$collection = New-Object System.Collections.ArrayList($null)
$obj = @{
Installed = $InstalledLicenseCountValue
Available = $Available
AvailablePercent = $AvailablePercent
Issued = $IssuedLicenseCountValue
Date = get-date
}
# Exit RDS location
set-location c:
# Create PSO Object with the data
$collection.Add((New-Object PSObject -Property $obj));
# Export Data into a file
$collection | export-csv $filename  -NoTypeInformation -Encoding UTF8

About Luciano

Senior Infrastructure Engineer med spesialitet på Citrix produkter

Check Also

Tid for å oppgradere: XenApp og XenDesktop 7.12 er her!

Hvis du kjører XenApp 6.5 i dag, følger du sannsynligvis med på  fremdriften av XenApp …

Legg igjen en kommentar

Din e-postadresse vil ikke bli publisert. Obligatoriske felt er merket med *