
Solution to Event 8 in the 2008 Winter Scripting Games Sudden Death Challenge.
We goofed. In the instructions for Event 8 we inadvertently typed USA as part of the address; that was supposed to be listed like this: US. Needless to say, that confused a few people. But don’t worry: we’ll give you credit for any answer you gave us for USA. No one will lose any points because of our mistake. |
So did we really expect everyone to know this information off the top of their heads? No, of course not. Unless you did nothing but write Active Directory scripts all day long this would be close-to-impossible. And even if you did do nothing but write Active Directory scripts all day long you might not remember that l (locality) is the official attribute name for what we would usually refer to as the city.
It’s just not the sort of thing that tends to come up in everyday conversation.
So was it even fair to ask a question if we didn’t think anyone would know the answer? Well, in a word: yes. After all, scripting – and system administration – is a huge and complex enterprise these days. No one could be expected to remember the names of every ADSI attribute, WMI property, or Windows PowerShell cmdlet. Instead, if you hope to be a successful scripter you need to know how to look up information. That’s why we decided this event was fair game.
So where do you look up this kind of information? Well, one obvious place would be the Active Directory Schema Reference on MSDN. If you look at the page for the User object you’ll see a list of all the attributes that belong to the user account. That means that your answers are there, somewhere. It just might take a little digging before you can determine which attribute belongs where.
Alternatively, you might take a look at the Microsoft Windows 2000 Scripting Guide. One nice thing about the Scripting Guide is that it features a bunch of pictures that relate attribute names to items you see in Active Directory Users and Computers. You know, pictures like this:

As you can see, this one picture gives you almost all the information you need to complete the table (and complete this event).
Much like WMI, ADSI can also be used to return information about its own properties and methods. For example, this script returns all the properties (mandatory and optional) for the User object:
Set objSchemaComputer = GetObject("LDAP://schema/user")
WScript.Echo "Mandatory (Must-Contain) attributes"
For Each strAttribute in objSchemaComputer.MandatoryProperties
WScript.Echo strAttribute
Next
WScript.Echo VbCrLf & "Optional (May-Contain) attributes"
For Each strAttribute in objSchemaComputer.OptionalProperties
WScript.Echo strAttribute
Next
Needless to say, this is not the answer; you still have to figure out what each of these attributes is actually for. But it helps.
Ah, but you don’t really care about any of that, do you? Instead, you just want to know the correct answers for Event 8. Here you go:
Value | LDAP Display Name |
Kenneth | givenName |
J | initials |
Myer | sn |
712 NE 40th Way | streetAddress |
Redmond | l |
WA | st |
98052 | postalCode |
US | c |
1-425-555-1235 | telephoneNumber |
kmyer@fabrikam.com |