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

Join the Jar Tippers on Patreon

It takes a lot of time to write detailed blog posts like this one. In a single-income family, this blog is one way I depend on to keep the lights on. I'd be eternally grateful if you could become a Patreon patron today!

Become a Patron!