your home for end-user virtualization!

Bulk add computers to active directory group using powershell

Needed to go through the environment and find all the computers per datacenter and add them to their respective security groups so they would get WSUS group policy applied to them:

So I had to search for a list of computers using powershell, then add that very same list of computers to an active directory group

$pcs= Get-ADComputer -LDAPFilter "(name=sue*)" -SearchBase "ou=thick,ou=3_workstations,DC=domain,DC=local"
foreach ($pc in $pcs) 
   Add-ADGroupMember "WSUS_WKS1" $pc