Jul 21 2022 09:52 AM
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 find how to do this in bulk with a CSV.
Set-ADUser -Identity username -Clear info
I can also use -Replace to add information
Set-ADUser -Identity username -Replace @{"info"=("Test1,Test")}
Can someone help me with this?
My CSV would use properties:
sAMAccountName, info, ipPhone
Thanks for any help.
Denise
Jul 21 2022 11:33 AM
SolutionThis 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}})
Jul 21 2022 12:21 PM
Jul 21 2022 12:43 PM
Jul 22 2022 06:22 AM
Jul 21 2022 11:33 AM
SolutionThis 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}})