Update AD users based on csv file

Hi There, 

I am trying to bulk update few users based on CSV file and got the following working script:

$users = Import-Csv "UserDetails.csv"
foreach ($user in $users) {
     $userEmail = $user."Email"
     $UPN = get-qaduser $userEmail | select UserPrincipalName
     set-qaduser -Identity $UPN.UserPrincipalName -Title $user."Title" -Department $user."Department" -StreetAddress $user."Street Address" -City $user."City" -PostalCode $user."Postal Code" 
}
Write-Host "There were " $usersInCSV "accounts in the CSV and the script updated " $count "accounts"

The above script is working fine, however in case any if any attribute is empty in the CSV, it clears out the existing value too. E.g. if I don't set CITY in CSV, it clears the existing value too. I know in Powershell, there is a command update-aduser which can help with this issue. Is there any command something similar in OneIdentity too?

Thanks in Advance

Parents Reply Children
No Data