Investigating AD Classes

by Mar 4, 2016

Active Directory organizes its content in classes like "user" or "computer". Each class has a predefined set of attributes, like "Name" or "distinguishedName".

PowerShell can get in touch with the AD schema, and investigate all of the attributes a given AD class supports – or requires. You also get detailed information about the data types and ranges that are valid for a given attribute.

Just make sure you are logged on to an Active Directory before you execute this code:

#requires -Version 1

$Name = 'User'

$type = [DirectoryServices.ActiveDirectory.ActiveDirectorySchema]
$type::GetCurrentSchema().FindClass($Name).MandatoryProperties
$type::GetCurrentSchema().FindClass($Name).OptionalProperties

Twitter This Tip! ReTweet this Tip!