Remove user license by PowerShell script
Hi,
Here are some info. Values in <> has been replaced by me.
PS C:\> Get-RDMDataSource
ID : <GUID>
IsConnected : True
IsOffline : False
Name : DVLS PowerShell
Type : RDMS
ID : <GUID>
IsConnected : False
IsOffline : False
Name : Local data source
Type : SQLite
PS C:\> $lic = Get-RDMLicense -Serial $serial
PS C:\> $lic
ActiveUsers : 85
Description : Remote Desktop Manager (Platinum Edition) <#> Users
EndDate : 31/07/2028
ID : <GUID>
IsAutoAssigned : True
License : <$serial>
MaximumUsers : <#>
OSC : <$serial>
Product : Remote Desktop Manager (Platinum Edition)
Status : Active
Users : {<Array of UserPrincipalNames>}
PS C:\> ($lic.Users | Where -Property IsMember -eq $True).Count
0
PS C:\> ($lic.Users | Where -Property IsMember -eq $False).Count
434
PS C:\> $lic.Users | Select -First 1
Description : <NAME>
HasActiveLicenseForSameProduct : False
IsAdministrator : False
IsMember : False
Name : <UserPrincipalName from AD>
Serial : <$serial>
UserId : <GUID>Let me know if you need me to run any specific commands.
Best regards,
Lars
Remove user license by PowerShell script
We recently purchased RDM Named users licenses and have setup autoassignement of these, which are working, and many users have a license now.
I have been trying to retrieve this through powershell, which im familiar with, but i have not used the Devolutions.PowerShell module before today.
We are using PowerShell 7.5.2 and Devolutions.PowerShell 2025.2.1 installed on the Devolutions Server.
Using
$lic = Get-RDMLicense -Serial $serial
$lic.UsersReports all users with "IsMember" equal to False. Do we need to have RDM installed for -RDM commands to work properly? (the docs said it was standalone now)
Using
$licResponse = Get-DSLicense
$lic = $licResponse.Data | Where -Property License -eq $serialReports nothing as it does not have the .Data property. $licResponse lists the only (RDM) license we have directly, maybe if you have more than one license you get an array of licenses instead into a Data property?
$licResponse.Users is present but empty if comparing to the Get-RDMLicense result.
Using $licResponse directly instead of the empty $lic works
$assignmentsResponse = Get-DSUserLicense -InputObject $licResponseReturn all users and with the correct "IsMember" property, but it does not have the $assignmentsResponse.Data property.
Although we achieved what we needed, i wanted to give some feedback as this has quite frankly been a grueling exercise crawling through docs/forum, trying to find the correct method of connecting, finding out that permissions needs to be set for the application identity, and which commands to use.
We have not used application assignments before and wrongly assumed they came with the necessary permissions.
Why not mention it in one of the https://docs.devolutions.net/powershell/dvls-powershell/powershell-connectivity/ or https://docs.devolutions.net/server/web-interface/administration/security-management/applications/ which are the entry points when setting, instead of having to stumble over it in the bottom of https://docs.devolutions.net/hub/web-interface/administration/management/application-users/manage-application-users/.
Logs with debug on gave no meaningful errors when trying to perform actions with the application identity without permissions:
ArgumentNullException - Value cannot be null. (Parameter 'source')
at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable`1 source, Func`2 selector)
at Devolutions.Server.Controllers.APIControllers.V2.NotificationController.GetCurrentUserNotifications()
Best regards,
Lars
Additional "2FA enabled" column + make "Last login" more accessible + possible to add 2FA to roles
Hi, had a couple of suggestions that Erica suggested i posted to the forums.
On the Administration -> Users page
- Please add a "2FA enabled" column the same way "Reset 2FA requested" is shown (and make it sortable).
- It would also be helpful if it was possible to export this userlist to csv where the "Last Login" attribute is included, or if it was include as a property on the Get-RDMUser command. As is today, there is no easy means of retrieving Last login.
Also, it would make things easier if it was possible to assign 2FA to roles, instead of having to assign it on individual users, and as an added bonus, it is not forgotten when a new user is assigned that specific role (eg. an admin type role).
Thanks,
Lars