Ask a questionAsk a question
 

Proposed AnswerSystem.__ComObject

  • Monday, August 28, 2006 4:32 AMsally_de Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
     

    hi

    when i run this code :

    public static void Main()

    {

    DirectoryEntry de = new DirectoryEntry( "LDAP://192.168.1.100/cn=a b, cn=Users, dc=soheila, dc=org"); PropertyCollection pc = de.Properties;

    foreach(string propName in pc.PropertyNames)

    {

    foreach(object value in de.Properties[propName])

    Console.WriteLine(" property = {0} value = {1}", propName, value);

    }

    }

    some of the property value pair that it shows are:

    property = uSNCreated value = System.__ComObject

    property = uSNChanged value = System.__ComObject

    property = badPasswordTime value = System.__ComObject

    property = lastLogoff value = System.__ComObject

    property = lastLogon value = System.__ComObject

    property = pwdLastSet value = System.__ComObject

    property = accountExpires

    value = System.__ComObject

    property = nTSecurityDescriptor value = System.__ComObject

    i want to know what does it means and how can i use the "lastLogoff","lastLogon",,,,,properties?

    regards........

    thanks.

All Replies

  • Tuesday, November 03, 2009 9:45 AMTommy Pang Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed AnswerHas Code
    Seem like this post kind of long without any reply. After few hours of google, I found a solution on that. I write myself a function in VB.NET to convert the System.__ComObject to valid Date Time. It basically for the few properties like badPasswordTime, uSNCreated and etc. You can refer below for the function:

       Private Shared Function ConvertADObjectToDate(ByVal Input As Object) As Date
            Try
                Dim Output As Date = "1601-01-01 08:00:00"
                Dim low As Object = Input.GetType.InvokeMember("LowPart", Reflection.BindingFlags.GetProperty, Nothing, Input, Nothing)
                Dim high As Object = Input.GetType.InvokeMember("HighPart", Reflection.BindingFlags.GetProperty, Nothing, Input, Nothing)
                Dim J As Long = (Convert.ToInt64(high) << 32) + Convert.ToInt64(low)
                Output = IIf(Convert.ToInt64(high) << 32 = -1 And Convert.ToInt64(low) = -1, Output, DateTime.FromFileTime(J))
                Return Output
            Catch ex As Exception
                Throw ex
            End Try
        End Function
    

    • Proposed As Answer byTommy Pang Tuesday, November 03, 2009 9:46 AM
    •