Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

For each computer found, add it to a security group?

$
0
0

Hi,

I am using the code below to get each computer that doesnt belong to the SCCM_Internet Explorer 9 group. Can I just add the following to the code below so that they each get assigned?

Add-ADGroupMember"SCCM_Internet Explorer 9"

Get-ADComputer -Filter * -SearchBase 'OU=Testing,DC=domain,DC=com' -Properties memberOf | ForEach { If ($_.memberOf -notcontains 'CN=SCCM_Internet Explorer 9,OU=Groups,DC=domain,DC=com') { $_ | Select Name,memberOf

#---->Add-ADGroupMember"SCCM_Internet Explorer 9" } }



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>