[python-win32] Re: New to Python from Perl

Roger Upole rwupole at msn.com
Thu Aug 24 04:46:59 CEST 2006


> Hey all I am learning Python and having a fun time doing so.  I have a question for y'all, it has to do with active directory.
>
> I want to get the last login for a computer from Active Directory.  I am using the active_directory module and here is my 
> code.
>
> [START]
>
> import active_directory
>
> computer = active_directory.root()
> for cpu in computer.search ("cn='Computer_Name'"):
>    print cpu.samAccountName ?--- Works find
>    print cpu.operatingSystem ?--- Works find
>    print cpu.lastLogon ?--- Getting Error
>
> [END]
>
>
> I get an error that I am not sure what to do with, the error is TypeError: coercing to Unicode: need string or buffer, 
> instance found in my line
> Do I have to change the output to meet Unicode formation?
>

I get back an ADLargeInteger for this property,
which actually represents a FILETIME.
What does type(cpu.lastLogon) show?

        Roger



More information about the Python-win32 mailing list