I am trying to compare a list of servers in a windows security group to a list of servers in my SQL CMS group (Central Management Server). I get the idea of how to compare 2 arrays…
$a = 1,2,3,4,5 $b = 4,5,6,7,8 $Yellow = $a | Where {$b -NotContains $_} $Blue = $b | Where {$a -NotContains $_}
But it doesn’t work with my server names. How do I troubleshoot?
$CMSservers = Get-DbaCmsRegServer -SqlInstance localhost -Group MyCMSgroup | Select-Object -ExpandProperty ServerName $ADlist = Get-ADGroupMember -identity "WindowsGroupName" -Recursive | select name
The yellow/blue comparison from above returns a full list of items in each of the array.