Get-ADOrganizationalUnit -Properties CanonicalName -Filter * -SearchBase “OU=SUSSE,DC=SUSSE,DC=LAN” | Sort-Object CanonicalName | ForEach-Object { [pscustomobject]@{ Name = Split-Path $_.CanonicalName -Leaf CanonicalName = $_.CanonicalName UserCount = @(Get-AdUser -Filter * -SearchBase $_.DistinguishedName -SearchScope OneLevel).Count ComputerCount = @(Get-AdComputer -Filter * -SearchBase $_.DistinguishedName -SearchScope OneLevel).Count } } Om een export te maken naar een txt file: $results | Out-File C:\export_OUs.txt […]