Can anyone give me some direction for handling the UTC Coded time? I think I'm just missing something obvious, but I just can't get this into a useable format for doing any kind of date math.
................................ Kind regards Glenn Deans Architect Siemens IT Solutions and Services Urbana, OH USA -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Deans, Glenn (IT Solutions US) Sent: Tuesday, January 27, 2009 3:15 PM To: [email protected] Subject: Date math with UTC Coded Time I'm tasked with obtaining a list of all systems in AD where the modifyTimeStamp is older than 90 days. Fairly easy to re-use some code and do some simple date math, right? I seem to be able to access the value from an ADO query, but it doesn't always display properly, even if I use Win32::OLE::Variant instead of dereferencing the variable like so: use Win32::OLE; $Win32::OLE::Warn = 3; use Win32::OLE::Variant; use constant ADS_SCOPE_SUBTREE => 2; use constant ADS_CHASE_REFERRALS_EXTERNAL => 0x40; $objConn = Win32::OLE->new('ADODB.Connection'); $objCmd = Win32::OLE->new('ADODB.Command'); $objConn->{Provider} = 'ADsDSOObject'; $objConn->Open('Active Directory Provider'); die Win32::OLE->LastError() if Win32::OLE->LastError( ); $objCmd->{ActiveConnection} = $objConn; $objCmd->{CommandText} = "Select Name,modifyTimeStamp from \'LDAP://DC=foobar,DC=com\' Where objectClass=\'Computer\'"; $objCmd->SetProperty("Properties", 'Page Size', 1000); $objCmd->SetProperty("Properties", 'Searchscope', ADS_SCOPE_SUBTREE); $objCmd->SetProperty("Properties", 'Chase referrals', ADS_CHASE_REFERRALS_EXTERNAL); my $objRecSet = $objCmd->Execute(); die Win32::OLE->LastError() if Win32::OLE->LastError( ); until ($recset->EOF){ $modified = $recset->Fields('modifyTimeStamp')->Value; print "Modified=$modified\n"; # displays $recset->MoveNext; } It seems any dates from last year come out as 1/9/2009 2:22:05 AM. I'm not sure what I'm doing wrong, but maybe someone could point it out to me? Then once that is corrected, how can you easily tell if it's > 90 days since it doesn't seem to be an epoch time? ................................ Kind regards Glenn Deans Architect Siemens IT Solutions and Services Urbana, OH USA _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
