Created
December 22, 2015 16:16
-
-
Save ciphertxt/e59f7b8df494a09bc715 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #requires -Version 2 -Modules ActiveDirectory | |
| Get-ADOrganizationalUnit -Filter * | | |
| ForEach-Object { | |
| $OU = $_ | |
| Get-ADComputer -Filter * -SearchBase $OU.DistinguishedName -SearchScope SubTree -Properties Enabled, OperatingSystem | | |
| Where-Object { $_.Enabled -eq $true } | | |
| Group-Object -Property OperatingSystem -NoElement | | |
| Select-Object -Property Count, Name, OU, OUDN | | |
| ForEach-Object { | |
| $_.OU = $OU.Name | |
| $_.OUDN = $OU.DistinguishedName | |
| $_ | |
| } | |
| } | | |
| Out-GridView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment