lastLogonTimeStamp and Vb.net and Active Directory

G

Guest

If anyone has an example of this I'd appreciate seeing it.


I'm having a problem with assigning the value of an object's
lastLogonTimeStamp property to a variable. I can do it with VbScript, but
can't get it in .Net.
The value is 64 bit. I'm trying to assign it to a Long variable.




dateLastLogon =
mySearchResult.GetDirectoryEntry.Properties("lastLogonTimestamp").Value




The above line doesn't work, but the below line does. The error I get is:


"An unhandled exception of type 'System.InvalidCastException' occurred in
microsoft.visualbasic.dll


Additional information: Cast from type '_ComObject' to type 'Long' is not
valid."




lstComputers.Items.Add(mySearchResult.GetDirectoryEntry.Properties("Name").Value)




Any ideas? If more info is needed, let me know.

TIA

-Ian
 
B

Bmack500

PS, I just posted some code showing how to do this... now if you could
tell me how to convert the value to something readable, like a datetime
value, that would help. I can only find examples in vbscript which
won't work in vb.net!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top