• Testing value in AD using DirectoryService NS (VB.NET)

    Home » Forums » Developers, developers, developers » DevOps Lounge » Testing value in AD using DirectoryService NS (VB.NET)

    Author
    Topic
    #376556

    I am using the DirectoryServices namespace to iterate through users in an OU and displaying their AD properties in the Output window. One property I’m particularly interested is the pwdLastSet, which identifies the checkbox indicating that the user must change their password at next login. It returns System.__ComObject every time and I need it to return a Boolean to be of any use to me. Below is what I copied out of the cmd window. Is there a way to get a meaningful value out of this property?

    >? User.Properties(“pwdLastSet”).Value
    {System.__ComObject}
    [System.__ComObject]: {System.__ComObject}

    Viewing 1 reply thread
    Author
    Replies
    • #617361

      This is a guess, but try using the ADSI property instead of the Active Directory property (see Platform SDK: Directory Services – Mapping between IADsUser Properties and Active Directory Properties). I think that means:

      User.PasswordLastChanged

      This might not apply to .NET, but it’s used in a script that is part of the Windows .NET Server Resource Kit, so… who knows?

      • #617512

        I looked at that script example and made a vbs out of it. When you run it it tells you that .PasswordLastChanged is not supported by this object. I love those examples that Microsoft provides that are completely worthless.

        I will check out that link related to your ADSI suggestion. I’ll let you know how it goes.

    • #621948

      I get the same error, Mike. You might try posting the issue in the MS newsgroup microsoft.public.adsi.general; I lurk there and bug the nice people with questions from time to time, almost always getting a more educated response than what I’m giving you now. wink Good luck!

    Viewing 1 reply thread
    Reply To: Testing value in AD using DirectoryService NS (VB.NET)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: