Reputation: 577
I want to update a set of AD users with a nested powershell command and I need help with that :(
Thanks for your help!
Upvotes: 1
Views: 516
Reputation: 3908
Have a look at how to use a result set
within a foreach
loop like this:
Get-ADUser -Filter 'extensionAttribute1 -like "*"' | foreach {
Add-ADGroupMember -Identity "GroupNAME" -Members $_.samaccountname
Set-ADUser –Identity $_.samaccountname -Clear "extensionattribute1"
}
Upvotes: 2