Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Looking for a way to automatically deallocate users' licenses after a certain number of days (based on "last used" column in QMC).
Does anyone know if this is possible?
Hey William,
Please see this script for a reference: https://github.com/levi-turner/QlikSenseScripts/blob/master/qlik_sense_purge_unused_user_access_pass...
It can be adapted to the subscription licensing if needed and does depend on Qlik-CLI. But it can be used as a reference in either case.
Hope that helps.
Hi William,
I think only if you create a rule where: user.isAnonymous () The token is allocated for 28 days.
But it would not be for inactivity.
I don't think there's any way you can do what you want.
You can, but try this by API like below:
Get a list of license allocation IDs:
GET /qrs/license/useraccesstype/full
Delete a specific license:
DELETE /qrs/license/useraccesstype/{IDfromAbove}
Check this:
If you want to remove a cal from a user, you can use the QMS API in QlikView to deallocate the cal. Keep in mind that deallocating the cal does not make it automatically available again. There is a 24 hour quarantine with QlikView 11.2 and a 7 day quarantine with QlikView 12 before the cal is allowed to be reallocated.
Definitely, do not attempt to modify pgo files.
To my knowledge there is no sample code for performing this activity. Here is the link to the QMS API: QlikView Management API - Getting Started and Examples
Hey William,
Please see this script for a reference: https://github.com/levi-turner/QlikSenseScripts/blob/master/qlik_sense_purge_unused_user_access_pass...
It can be adapted to the subscription licensing if needed and does depend on Qlik-CLI. But it can be used as a reference in either case.
Hope that helps.
Thanks guys,
Can't implement this solution just yet, but this seems to be the way to go.
Hello,
I'm trying to use the script, but it seems like nothing is happening after the script is done except for the confirmation of the connection to Qlik Sense.
Anything that I should check?
Hi Levi,
we tried to implement token auto deallocation using powershell script and we got below error.
Error:
Invoke-RestMethod : The remote name could not be resolved: 'myserver.com'
Token unusaed deallocation script:
$InactivityThreshold = Read-Host -Prompt 'Input the username date threshold for inactivity (e.g. 90)'
# Get date format for 90 days ago
$date = Get-Date
$date = $date.AddDays(-$InactivityThreshold)
$date = $date.ToString("yyyy/MM/dd")
$time = Get-Date
$time = $time.GetDateTimeFormats()[109]
$inactive = $date + ' ' + $time
# Connect to Qlik Sense
$myFQDN=(Get-WmiObject win32_computersystem).DNSHostName+"."+(Get-WmiObject win32_computersystem).Domain
$myFQDN = $myFQDN.ToLower()
# Connect to Qlik-CLI
Connect-Qlik -ComputerName $($myFQDN)
function Remove-QlikUserAccessType {
[CmdletBinding()]
param (
[parameter(Position=0,ValueFromPipelinebyPropertyName=$true)]
[string]$id
)
PROCESS {
return Invoke-QlikDelete -path "/qrs/license/useraccesstype/$id"
}
}
Get-QlikUserAccessType -filter "lastUsed lt '$inactive'" -full # | Remove-QlikUserAccessType
Error:
Invoke-RestMethod : The remote name could not be resolved: 'myserver.com'
At C:\Program Files\WindowsPowerShell\Modules\Qlik-Cli\1.15.1\functions\core.ps1:30 char:17
+ ... $result = Invoke-RestMethod -Method $method -Uri $path @params -Ses ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Do you have any idea how to resolve this error?
Please let us know your input on this.
Regards,
Balaji
please note that this could be a violation of the license agreement.