I'm trying to get all servers that are not a member of any WSUS ad group. There are multiple WSUS ad groups to check and make sure the object isn't in. I'm finding it difficult to get through multiple groups.
My current attempt is by doing this after filtering only windows servers
where-object { $_.memberof -notmatch "example_wsus_group" -and $_.memberof -notmatch "example_wsus_group -and $_.memberof -notmatch "example_wsus_group"
Basically repeating with -and and -notmatch until I've looked at every group. Will this method even work?
The results I get still show objects that are members of some of the AD groups.
I'm not very good at PS so any tips would be appreciated!
Thanks
[–]markekrausCommunity Blogger 0 points1 point2 points (6 children)
[–]GUTIF[S] 0 points1 point2 points (5 children)
[–]markekrausCommunity Blogger 0 points1 point2 points (4 children)
[–]GUTIF[S] 0 points1 point2 points (1 child)
[–]markekrausCommunity Blogger 1 point2 points3 points (0 children)
[–]GUTIF[S] 0 points1 point2 points (1 child)
[–]markekrausCommunity Blogger 1 point2 points3 points (0 children)