How to find computers with a name starting with something and add them to a security group.

Dou, that was a long sentence 🙂

But here is how.

$computers =
get-adcomputer -ldapfilter
“(name=name*)”
$computers |
foreach {Add-ADGroupMember
-id name_of_the_group
-MEMBERS $computers.samaccountname}
Happy powershelling!
Author: Harri Jaakkonen

Leave a Reply

Your email address will not be published. Required fields are marked *