Add all users located in a single Organizational Unit to a Group using PowerShell.
First line creates a value for $names. $names will search and grab all the users located in the path given to SearchBase parameter.
Second line under Member parameter, when given $names variable, sends that information to the Add-ADGroupMember command. Identity parameter is the name of the Group it will send information to.
I’m sure there are better ways of doing this, but figured this one out as fast as I could on my own trying to get some work done in a timely manner.
$names=Get-ADUser -Filter * -SearchBase "OU=MyOU,DC=MyDomain,DC=com" Add-ADGroupMember -Identity "Group Name" -Members $names