Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Get-ADComputer based on group membership

$
0
0

Hello,

I'm trying to get AD computers based on their Operating System and the groups they are not a member of. I've been googling a lot and trying different things but can not get it to work so I'm hoping you guys can help me out.

This is the piece of script I'm trying to get to work:

Get-ADComputer-Filter {OperatingSystem-like"Windows Server*"} -server domain.local|Where-Object {$_.Memberof -notlike$gb-and$_.Memberof -notlike$gnob}

$gb = group1 

$gnob = group2 


Viewing all articles
Browse latest Browse all 6937

Trending Articles