How to Find the Max Length for an Active Directory Attribute

Adam Bertram

Adam Bertram

Read more posts by this author.

Today, I had some users complaining that they could not populate a certain Active Directory attribute with a fairly long string. Because I didn’t want to fire up ADSIedit to do this, I decided to use PowerShell.

As always, it was a cinche after I found the appropriate .NET object and method to use. Props to this Scripting Guy blog post Exploring Active Directory Data Types with PowerShell that got me started.

$schema =[DirectoryServices.ActiveDirectory.ActiveDirectorySchema]::GetCurrentSchema()
## I'm looking for user attributes and the property I'm looking for is an optional attribute
## The rangeUpper attribute is what tells us the max length of what can go into that particular attribute
$schema.FindClass('user').optionalproperties | select name,rangeupper

Subscribe to Adam the Automator

Get the latest posts delivered right to your inbox

Looks like you're offline!