Forum Discussion

Denise Child's avatar
Denise Child
Iron Contributor
Jul 21, 2022

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...
  • farismalaeb's avatar
    Jul 21, 2022

    Denise Child 

    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}})

Resources