Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Bulk update of AD users properties

$
0
0

Hi, I have Windows Server 2008 R2 domain/forest functional level. My company is undergoing a major reorganization so every employee has changed it's title, department, . . . so I would like to modify user attributes/properties with PowerShell. I can get .csv file from HR department with all necessary data like SamAccountName, Description, Office, . . . I decided to create a test user and update its properties by creating .csv file and using Set-ADUser cmd-let.

Import-CSV test.csv | ForEach-Object {Set-ADUser -Identity $_.SamAccountName -Description $_.Description . . .}

I noticed that PowerShell always returns an error when value of any property is blank string (,, in .csv file). This is the case which I will be facing having obtained .csv file from HR since some employees does not have mobile phone or fax number or some other property. Why I can not pass blank string as a value to any property of AD user? As soon as I give some value to every property (phone number, fax number, . . .) everything works fine and user properties are set as they should be.

Thanks in advance!






Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>