QlikSenseScripts icon indicating copy to clipboard operation
QlikSenseScripts copied to clipboard

Issue in executing below code - # Remove Professional Access passes over date threshold

Open ShalakaKshirsagar opened this issue 2 years ago • 0 comments

Hi @levi-turner

I am trying to remove the Professional Access passes over date threshold date. However not working and getting below error.

Code

Set the inactivity threshold. This is interactive. A non-interactive version can use this approach:

$InactivityThreshold = '30' # This is for 30 days

$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 using Qlik-CLI

Connect-Qlik | Out-Null

Write-Host $inactive

Remove Professional Access passes over date threshold

Get-QlikProfessionalAccessType -filter "lastUsed lt '$inactive'" -full | Remove-QlikProfessionalAccessType

=============================================================================

Error

Remove-QlikProfessionalAccessType : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input. At line:21 char:76

  • Get-QlikProfessionalAccessType -filter "lastUsed lt '$inactive'" -full | Remov ...+
    • CategoryInfo : InvalidArgument: ([{"id":"acdefff...alAccessType "}]:PSObject) [Remove-QlikProfessionalAccessType], ParameterBindingExcepti
      on + FullyQualifiedErrorId : InputObjectNotBound,Remove-QlikProfessionalAcces sType

ShalakaKshirsagar avatar Apr 08 '22 17:04 ShalakaKshirsagar