Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am unable to figure out the syntax for updating the custom property when trying tom Update-QlikUser when using the cli module.
Has anyone managed to update a user's custom property?
Below is the module gallery:
https://www.powershellgallery.com/packages/Qlik-Admin-Utils/3.2.5.1/Content/Update-QlikUser.ps1
bump. Anyone?
A few thoughts:
Connect-Qlik Get-QlikUser -filter "userid eq 'test@test'" | Update-QlikUser -customProperties UserCustomProperty=foo
Additionally, Qlik Branch's Slack instance, specifically the #qrs-api and/or #qlik-cli channels may be a more appropriate venue for getting more insight: http://qlikbranch-slack-invite.herokuapp.com/
Hi @Levi_Turner ,
How to remove Custom Property value for a particular user? Appreciate you help.
Thanks!
HI @Levi_Turner ,
With the below endpoint, we can not append the value. This is replacing all the other value with 'foo'
Get-QlikUser -filter "userid eq 'test@test'" | Update-QlikUser -customProperties UserCustomProperty=foo
How can we append with the existing value?
Hey @babitaku ,
Adapted from @Marc 's code here: https://github.com/ahaydon/Qlik-Cli-Windows/issues/133
Connect-Qlik
$newCustomProp = "Group=DL-Enterprise Team"
$user = Get-QlikUser -filter "userDirectory eq 'ANYDIR' and userId eq 'ltu'" -full
[string[]]$customProperties = ""
[string[]]$customProperties = $($user.customProperties|%{"$($_.definition.Name)=$($_.value)"})
$customProperties += $newCustomProp
$user | Update-QlikUser -customProperties $customProperties
just a quick update to the above.... if only because I hate using '+=' even if I did perpetrate its use here...
+= has a fairly hefty performance impact, trivial and not worth worrying about for small sets of items, but noticeable when there is a lot of data (like in a production environment)
the better way to do this is using a Generic List object... like so..
Connect-Qlik
$newCustomProp = "Group=DL-Enterprise Team"
$user = Get-QlikUser -filter "userId eq 'marc'" -full
[System.Collections.Generic.List[string]]$customProperties = ""
if ($user.customProperties.Count -gt 0)
{
$customProperties.AddRange($($user.customProperties | ForEach-Object{"$($_.definition.Name)=$($_.value)"}))
}
$customProperties.Add($newCustomProp)
$user | Update-QlikUser -customProperties $customProperties
Example for why not to use '+='
10,000 objects using '+=' takes 11.31 seconds
10,000 object using List.Add takes 0.54 seconds
You rock @Levi_Turner
Thank you so much. This saved our tedious work of manually adding Custom Properties 🙂
Hi @babitaku ,
did you figure out how to remove the custom properties using the cli?
I am looking to remove all the custom properties assigned to all the users. i would appreciate any help.
Thank you,
Ilyas
Hi Levi_Turner,
I 'm facing an issue in updating a custom property for the new stream that was created using windows PowerShell script (Qlik CLI) .Please consider the below example of Custom Property :
Group=AB=QS_ABCD_Developer,CD=Efg,GH=LOB,IJ=PROD,IJ=KLMN,IJ=net where 'Group ' is the Custom Property Name and 'AB=QS_.....=net' is the Value.
Below is the syntax I'm using which is not working.
Update-QlikStream -id $streamid -customProperties @("Group=AB=QS_ABCD_Developer,CD=Efg,GH=LOB,IJ=PROD,IJ=KLMN,IJ=net")
I tried esc character ` for the = and , since other property value without the commas and eq to worked, only this property where the value is in such way is not working for me.
Any suggestion here would be of great help.Thanks,
Padmini