# customobj.ps1 #### Read that sheet yo $filePath = "testdata.xlsx" # # Rando Vars $ # $InputHash = @(Import-Excel testdata.xlsx) $OutputHash = @{} # Import-Excel $filePath | # ForEach-Object { # # $OutputHash[$_.Directory] = $_.Directory #| Write-Host # # $OutputHash[$_.UserName] = $_.UserName #| Write-Host # # $OutputHash[$_.UserName] = $_.UserName #| Write-Host # $OutputHash.Add($_.Server,$_.UserName,$_.UserRole,$_.StreamAdminNN,$_.StreamPublishAccess,$_.StreamReadAccess) # # Write-Host ($_.Directory)"\"($_.UserName)#": "($_.UserRole) # # Write-Host ($_.Directory)"\"($_.UserName)#": "($_.UserRole) # } Get-ChildItem -Path cert:\CurrentUser\My | Where-Object {$_.subject -eq 'CN=QlikClient'} | Connect-Qlik -computername https://qseow.browntown.local:4242 -Username browntown\djx | Out-Null $idList = @( 'djx' # 'qlik' ) $UserCustProp = foreach ($ID in $idList) { # Use "Get-QlikUser to filter on userId key, then pipe through Where-Object to filter results on userDirectory if ($qlikUser = Get-QlikUser -filter "userId eq '$ID'" | Where-Object {$_.userDirectory -eq 'BROWNTOWN'} ) { # For each filtered result, use the resulting ID# to do a "full" lookup on the user, retrieve customProps if ($idHash = Get-QlikUser -id $qlikUser.id) { # ################# CustomObject Block # [PSCustomObject]@{ # "UserID" = $ID # "UserAccessLevel" = ( $idHash.customProperties.definition.name ) # # "UserAccessLevel" = ( $propHash.value | Get-Unique) # # "Stream ==> Access" = $idHash.customProperties.definition.name+" "+$idHash.customProperties.value # "CustProp" = $idHash.customProperties.value # } # ################# CustomObject Block END } } } # $StreamPerms = foreach ($StreamName in ($idHash.customProperties.value)) { # [PSCustomObject]@{ # StreamName = $StreamName # # MemberList = ($idHash | Where-Object customProperties -Contains $StreamName).value # MemberList = ($idHash | Where-Object customProperties -Contains $StreamName).value # } # } $UserCustProp | Format-List # Write-Host "'Value of $idHash' = ${customPropHash}" # $StreamPerms | Format-Table -a