Scripting Help: Retrieving License Information in Report

Resolved

Scripting Help: Retrieving License Information in Report

avatar

Hello RDM Community,

I'm working on a script under a report in Remote Desktop Manager, and I'm trying to retrieve three variables for each connection:

1. License Name
2. License Count
3. Expiration Date

All these parameters are stored under "Software License" for each connection.

Here's the script I've come up with:

```powershell
foreach ($connection in $Report.Connections) {
# Check if the connection is under the specified folder
if ($connection.Group -eq '#folder Path' -and $connection.Name -ne 'lizenzen') {
$Report.NewRow();
$Report.SetValue("Name", $connection.Name);
##These two lines are wrong because I wrote the wrong variables.
$Report.SetValue("LicenseCount", $connection.GetCustomProperty("LicenseCount"));
$Report.SetValue("ExpirationDate", $connection.GetCustomProperty("ExpirationDate"));
}
}
Thank you.

All Comments (5)

avatar

Hello,

You must use the proper path of the property. A method to find it is to follow these instructions.
https://docs.devolutions.net/rdm/windows/powershell-scripting/tips-tricks/

Let us know if that helps.

Best regards,

Érica Poirier

avatar

Hello Erica,

Thank you for your reply.
I think I've found the variable names:

<SoftwareLicenseCount>28</SoftwareLicenseCount>
<SoftwareExpiration>2024-01-16T13:36:37.5135532+00:00</SoftwareExpiration>

Updated Skript :

foreach ($connection in $Report.Connections) {
# Check if the connection is under the specified folder
if ($connection.Group -eq 'documentus Deutschland GmbH\lizenzen' -and $connection.Name -ne 'lizenzen') {
$Report.NewRow();

$Report.SetValue("Name", $connection.Name);
$Report.SetValue("LicenseCount", $connection.SoftwareLicenseCount);
$Report.SetValue("läuft ab am", $connection.SoftwareExpiration);



}
}

->Unfortunately, I'm still not getting any results.

avatar

Hello,

Thank you for your feedback.

You seem to have followed these instructions.
https://docs.devolutions.net/kb/devolutions-powershell/remote-desktop-manager/create-custom-field-report/

In the General tab, have you set the column header names (Name, LicenseCount, läuft ab am) in the Fields section?

Best regards,

Érica Poirier

avatar

I found where the error is , actually the variable names are right but the line was missing something :

$Report.SetValue("LicenseCount", $connection.SoftwareLicenseCount);
$Report.SetValue("läuft ab am", $connection.SoftwareExpiration);
-
$Report.SetValue("Lizenzanzahl", $connection.DataEntry.SoftwareLicenseCount);
$Report.SetValue("läuft ab am", $connection.DataEntry.SoftwareExpiration);

This Post can be closed .

Thank you Erica for your Help !

avatar

Hello,

Thank you for your feedback, and I'm glad you have found the solution!

Best regards,

Érica Poirier