Forum Discussion
PSNewie2021
Aug 26, 2021Copper Contributor
Update AD Users' Email Address from CSV where this field is empty in AD (except specific domain)
Hi There, I am trying to create a PS script with the following conditions and hoping someone here is able to guide me. Any assistance would be highly appreciated. Import users from a CSV file...
kevin_devon
Apr 11, 2022Copper Contributor
Good Daypsophos I like the idea of this, but I want to use it for something other then email.
Is this possible? IE, I need to modify the homePostalAddress, this is currently either clear or has a License code using A2B1 etc etc. I need the blanks to have this A2B1C1D1, the reason I cannot run a script to ovewright everything is everyone is not the same, some have A2B1C2D1J1 and some have A2B1C1D1J4 etc,
Newbie_Jones
Apr 11, 2022Brass Contributor
General etiquette would be to start your own thread for this question.
If you just want to set the field if its blank, then this is a two step process.
Not tested, but it will be something like.
Get-ADUser -properties homePostalAddress -filter 'homePostalAddress -notLike "*"' |
ForEach {Set-ADuser -Identity $_ -Add @{homePostalAddress = 'A2B1C1D1'}}