But...here is the kicker. Computers don't logon to the network, users do. You have to use the pwdLastSet property. Here is a better example for computer accounts...

Code:

Break On

Call "fnADD.kix"
Call "fnFlipcTime.kix"
Call "fnLDAPQuery.kix"

$Date = "2005/4/11"
$Time = "00:00:00"

$sDate=""+FlipcTime($Date,$Time,-4)
$sDate=Add('11644473600',$sDate)+"0000000"

$sWhat = "Name","ADsPath"

$sFrom = "LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")

$sFilter = "(&(objectClass=computer)(pwdLastSet<="+$sDate+"))"

$sScope = "subtree"

$aResults = fnLDAPQuery($sWhat,$sFrom,$sFilter,"Name",$sScope)
@ERROR " : " @SERROR ?

For Each $Result in $aResults
If VarType($Result)>8192
For Each $R in $Result
$R ?
Next
Else
$Result ?
EndIf
Next

? UBound($aResults) ?

Get $



Edited by Chris S. (2005-05-26 07:09 PM)