-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue in executing below code - # Remove Professional Access passes over date threshold #180
Comments
It looks like the issue is with the command If I run |
Hi @ahaydon many thanks for the response.$date = Get-Date
|
It looks like this depends on the version of PowerShell being used, since that works for you I assume you are using PowerShell 5. The correct format should look like this '2022-04-11T10:58:54', so you can use A more consistent approach would be to use |
Great !! Many thanks for the quick input. I tried both the suggested options.. However still no luck ! :( BEFORE removing, i am trying to print the UserId which will be removed (just for the testing) using foreach loop. $InactivityThreshold = Read-Host -Prompt 'Input the username date threshold for inactivity (e.g. 90)' Get date format for 90 days ago$inactive = Get-Date #Write-Host $inactive $inactive =Get-Date $inactive -Format 'yyyy-MM-ddTHH:mm:ss' Connect using Qlik-CLIConnect-Qlik | Out-Null Remove Professional Access passes over date threshold#Get-QlikProfessionalAccessType -filter "lastUsed lt '$inactive'" -full | Remove-QlikProfessionalAccessType $a=Get-QlikProfessionalAccessType -filter "lastUsed lt '$inactive'" -full foreach ($b in $a){ anythign missing here? |
Hello @ahaydon I am getting LastUsed value something like - "lastUsed":"2022-03-26T15:15:06.468Z" Do i need to convert this format ? |
Hello @ahaydon , Below simple script is also not working.. seems its not executing for loop. Anything missing? $QSUsers=Get-QlikUser -filter "inactive eq true" -full foreach ($QSUser in $QSUsers){
} |
I would simplify your test further, what is returned when you just run |
Hi @ahaydon ,
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
Remov ...+
"}]:PSObject) [Remove-QlikProfessionalAccessType], ParameterBindingExcepti
on + FullyQualifiedErrorId : InputObjectNotBound,Remove-QlikProfessionalAcces
sType
The text was updated successfully, but these errors were encountered: