TXTOM,
Welcome to the forum.
Before we proceed - when you post code or sample data or console output please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
Thanks in advance
You should go back and edit your other two posts to fix the formatting of your code. This way we can distinguish properly between code and not code.
I think you’re confused by the fact that you don’t see a $false
for non critical system objects while you see a $true
for critical system objects. You may run the following lines of code see what I meant.
$ADGroupList =
Get-ADGroup -Filter * -Properties members, isCriticalSystemObject
$IsCritical =
$ADGroupList |
Where-Object { $_.IsCriticalSystemObject}
$IsNotCritical =
$ADGroupList |
Where-Object { -not $_.IsCriticalSystemObject}
In theory the amount of objects in the $ADGroupList
should be the sum of both other variables:
$ADGroupList.Count
$IsCritical.Count
$IsNotCritical.Count
… and at least in my environment it is.
When you output a few of the critical groups you see the $true
:
$IsCritical |
Select-Object -Property Name, isCriticalSystemObject -First 20
While there’s no value at all for non critical groups:
$IsNotCritical |
Select-Object -Property Name, isCriticalSystemObject -First 20