diff --git a/qs-custprop-migration.ps1 b/qs-custprop-migration.ps1 index bf2ece5..8973f2d 100644 --- a/qs-custprop-migration.ps1 +++ b/qs-custprop-migration.ps1 @@ -33,11 +33,12 @@ if (Test-Path $newCmdFile) { Get-ChildItem -Path cert:\CurrentUser\My | Where-Object {$_.subject -eq 'CN=QlikClient'} | Connect-Qlik -computername https://"$CentralNode":4242 -Username $QlikID | Out-Null -# Set $UserArray to a sorted, unique set of UserName from XLSX +# Set $UserArray to a sorted, unique set of UserName from XLSX. Convert all to UPPERCASE foreach ($row in $xlsx) { $UserArray += $row.UserName } $UserArray = $($UserArray | Sort-Object -Unique) +$UserArray = $UserArray.ToUpper() # ForEach unique UserName in the xlsx, lookup the corresponding QSEoW UserID Number. # If the UserName is in the User table for QSEoW, perform an Update-QlikUser with xlsx props. @@ -54,13 +55,10 @@ foreach ($userID in $UserArray) { $userIDNum = ($(Get-QlikUser -filter "userid eq '$userID'") | Where-Object {$_.userDirectory -eq 'BROWNTOWN'} ).id - if ( $userIDNum ) { - # $newCMD = @() # Lookup the current Custom Properties for each UserName from the spreadshseet. $currCPvals = $((Get-QlikUser -id "$userIDNum").customProperties) - # $currCPvals = $(Get-QlikUser -filter "userid eq '$userID'" -full ).customProperties foreach ($currVal in $currCPvals) { $curr = $currVal.definition.name + "=" + $currVal.value @@ -101,5 +99,6 @@ foreach ($userID in $UserArray) { # Build the new list of commands that will update our users that exist in both the XLSX and QSEoW. $newCMD = ("Update-QlikUser -id $userIDNum -customProperties " + '@(' + $newProps + ')' ) $newCMD | Out-File -Append $newCmdFile + Invoke-Expression $newCMD | Out-File -Append $outputLog } } \ No newline at end of file diff --git a/testdata.xlsx b/testdata.xlsx index 07956dc..271e74d 100644 Binary files a/testdata.xlsx and b/testdata.xlsx differ