Forum Discussion
Denise Child
Jul 21, 2022Iron Contributor
bulk replace or clear two attributes in Active Directory - (Info and ipPhone)
Hello, We need to replace or clear two attributes in Active Directory for many people. Those attributes are "info" and "ipPhone". I can use -Clear on an individual user, but am unable to fin...
- Jul 21, 2022
This is the code
$x=import-csv C:\Users\f.malaeb\test1.cvs #Clear $x.ForEach({Set-ADUser $_.sAMAccountName -Clear Info,ipphone}) #Replace $x.ForEach({Set-ADUser $_.sAMAccountName -Replace @{info=$_.info;ipPhone=$_.ipPhone}})
farismalaeb
Jul 21, 2022Steel Contributor
Can you tell if the error for users with blank fields or not.
I my test I had 2 users only
I my test I had 2 users only
Denise Child
Jul 22, 2022Iron Contributor
Yes, if I have nothing in Notes (info) I get the error. If I am simply replacing text in Notes, no error.
Since we only want to clear iPPhone I updated that part line to remove Info.
Since we only want to clear iPPhone I updated that part line to remove Info.