O PowerShell a seguir examinará a classe de usuário do esquema , pegue seu allowedAttributes
attribute, procure a definição de cada atributo e retorne seu rangeUpper
valor.
# Need the Microsoft AD PS module
Import-Module ActiveDirectory
# Get the user class definition, include "allowedAttributes"
$userClass = Get-ADObject -SearchBase ((Get-ADRootDSE).schemaNamingContext) -Filter { Name -eq "User" } -Properties allowedAttributes
# Walk the allowedAttributes array and sort into a table with "name" and "rangeUpper"
$userClass.allowedAttributes |
ForEach-Object { Get-ADObject -SearchBase ((Get-ADRootDSE).schemaNamingContext) -Filter { LDAPDisplayName -eq $_ } -Property rangeUpper } |
Sort-Object Name |
Format-Table -Property Name, rangeUpper
# If you want to only see defined "rangeUpper" values
$userClass.allowedAttributes |
ForEach-Object { Get-ADObject -SearchBase ((Get-ADRootDSE).schemaNamingContext) -Filter { LDAPDisplayName -eq $_ } -Property rangeUpper } |
Where-Object { $_.rangeUpper } |
Sort-Object Name |
Format-Table -Property Name, rangeUpper