Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S-OS-W10 should not count disabled computers #267

Open
PorreKaj opened this issue Nov 19, 2024 · 2 comments
Open

S-OS-W10 should not count disabled computers #267

PorreKaj opened this issue Nov 19, 2024 · 2 comments

Comments

@PorreKaj
Copy link

in S-OS-W10 a powershell command is mentioned, to help you find Computers by OS version.

Get-ADComputer -Filter {(Enabled -eq $true) -and (OperatingSystem -Like "*Windows 10*")} -Property Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion | format-table Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion -Wrap -Auto

The data returned does not match the numbers in the report (the cmd returns 5 computers, where the report shows 18 (0 active))
I can get the command to return 18 if I remove the condition for Enabled -eq $true.

It would make sense not to count disabled computers, the wording of the score descriptions makes it sound like any presence of older OS'es even disabled once, will grant a score of 5.

@PorreKaj
Copy link
Author

Correction, disabled objects does not make this rule count for 5. Wording in the Rule description would be an appreciated change, as would not counting disabled computers as inactive.

@PorreKaj
Copy link
Author

I've assembled a script to make the discovery of Devices running older OS'es much easier, I don't know much text you would want to include in your descriptions, but feel free to do so if you see any value therein.

`function ConvertWindowsBuild{
[CmdletBinding()]
param(
[string] $OperatingSystem,
[string] $OperatingSystemVersion
)
if (($OperatingSystem -like 'Windows 10') –or ($OperatingSystem -like 'Windows 11*')) {
$WinBuilds= @{
'10.0 (26100)' = "Windows 11 24H2"
'10.0 (22631)' = "Windows 11 23H2"
'10.0 (22621)' = "Windows 11 22H2"
'10.0 (19045)' = "Windows 10 22H2"
'10.0 (22000)' = "Windows 11 21H2"
'10.0 (19044)' = "Windows 10 21H2"
'10.0 (19043)' = "Windows 10 21H1"
'10.0 (19042)' = "Windows 10 20H2"
'10.0 (18362)' = "Windows 10 1903"
'10.0 (17763)' = "Windows 10 1809"
'10.0 (17134)' = "Windows 10 1803"
'10.0 (16299)' = "Windows 10 1709"
'10.0 (15063)' = "Windows 10 1703"
'10.0 (14393)' = "Windows 10 1607"
'10.0 (10586)' = "Windows 10 1511"
'10.0 (10240)' = "Windows 10 1507"
'10.0 (18898)' = 'Windows 10 Insider Preview'
}
$WinBuild= $WinBuilds[$OperatingSystemVersion]
}
else {$WinBuild = $OperatingSystem}
if ($WinBuild) {
$WinBuild
} else {
'Unknown'
}
}

$Comps= Get-ADComputer -filter "OperatingSystem -like 'Windows 1'" -properties *
$CompList = foreach ($Comp in $Comps) {
[PSCustomObject] @{
Name = $Comp.Name
enabled = $comp.enabled
OperatingSystem = $Comp.OperatingSystem
Build = ConvertWindowsBuild -OperatingSystem $Comp.OperatingSystem -OperatingSystemVersion $Comp.OperatingSystemVersion
LastLogonDate = [DateTime]::FromFileTime($Comp.LastLogon)
distinguishedname = $Comp.distinguishedname
}
}
$CompList | Out-GridView`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant