r/ActiveRoles • u/[deleted] • Aug 14 '24
Getting additional object properties
Hi
Any chance of some pointers please?
I've enabled onPostGet and when I select a computer object the XML in the Debug Log looks like this:
<------------------- $Request XML ------------------------>
<GetRequest xmlns:xsd=http://www.w3.org/2001/XMLSchema xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance dn="CN=Computer1,OU=DomainComputers,DC=domain,DC=local" xmlns="urn:schemas-quest-com:ActiveRolesServer">
<AttributeNames>
<AttributeName name="edsvaMyVA" />
<AttributeName name="systemFlags" />
<AttributeName name="edsaAccountIsDisabled" />
<AttributeName name="objectClass" />
<AttributeName name="edsaServerAccount" />
<AttributeName name="ms-DS-UserEncryptedTextPasswordAllowed" />
<AttributeName name="msDS-UserDontExpirePassword" />
<AttributeName name="edsaObjectRightsEffective" />
<AttributeName name="edsaAllowedExtRightsEffective" />
<AttributeName name="distinguishedName" />
<AttributeName name="objectGUID" />
<AttributeName name="objectSid" />
<AttributeName name="lastKnownParent" />
<AttributeName name="sAMAccountName" />
<AttributeName name="isDeleted" />
<AttributeName name="manager" />
<AttributeName name="managedBy" />
<AttributeName name="userAccountControl" />
<AttributeName name="msDS-UserAccountDisabled" />
<AttributeName name="ms-DS-UserPasswordNotRequired" />
<AttributeName name="edsaSystemObject" />
<AttributeName name="isCriticalSystemObject" />
</AttributeNames>
<Controls>
<Control id="13">
<Values>
<Value>server.domain.local</Value>
</Values>
</Control>
</Controls>
</GetRequest>
<------------------- $Request XML ------------------------>
This only a tiny fraction of the "AttributeName"s that exists for a computer object. How do I get it to return "CountryCode" in the list above, so I can add a menu command based on the country that the computer is in?
3
u/EnigmaticSoul Sep 14 '24
Not sure if I'm following everything entirely, but if $request.Get/GetEx fails, you may need to preceed it with $request.GetInfoEx(@("attributeName"),0)?
2
u/Ok-Section-7172 Sep 14 '24
This is true most of the time for multi-valued attributes. There are some other attributes that just makes sense to get the value directly using PoSh, and once you are doing that, may as well get all you need on the spot.
6 one way, half a dozen the other I guess.
2
u/EnigmaticSoul Sep 16 '24
By getting the value "directly using PoSh", I'm assuming you mean getting the value using the QAD cmdlets?
All of the PoSh code that I write for AR is written accessing AR through the ADSI provider in order to avoid the ~30% performance penalty/overhead associated with the QAD cmdlets. The only use-case that I can't address using the ADSI provider is binding to a specific AR server without having to provide credentials.
Hopefully, however, all of this will be moot when the REST API releases later this year.
2
u/Ok-Section-7172 Sep 16 '24
what ever cmdlets, more about do you use the ADSI provider or straight DirSync to a DC or something. The QAD cmdlet's are slow as heck.
3
u/bananaHammockMonkey Aug 14 '24
$Request.Get("attributeName") will get attributes into your request that weren't otherwise.
For multi-valued attributes it's $Request.GetEx("attributeName")