Dependencies: Add(), FlipCTime(), Replace(), fnLDAPQuery(), DSRM
Thanx for the help Chris, this worked great!

Code:

BREAK ON
$ = SetOption("WrapAtEOL")

$Date = "2005/3/1"
$Time = "00:00:00"


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


$sWhat = "ADsPath"


;$sFrom = "LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")
$sFrom = "LDAP://OU=test,DC=Microsoft,DC=Com"


; Search for users who are not disabled and w/o the "NoExpirey" flag set and have not changed their pwd by a certain date.
$sFilter = "(&(objectClass=computer)(pwdLastSet<="+$sDate+")"+
"(!userAccountControl:1.2.840.113556.1.4.803:=2)"+
"(!userAccountControl:1.2.840.113556.1.4.803:=65536))"


$sScope = "subtree"


$aResults = fnLDAPQuery($sWhat,$sFrom,$sFilter,"Name",$sScope)


For Each $Result in $aResults
If VarType($Result)>8192
For Each $R in $Result
$R ?
Next
Else
$Result = Replace($Result,"LDAP://","")
SHELL '%COMSPEC% /e:1024 /c dsrm -noprompt "$Result"'
EndIf
Next

? UBound($aResults) ?

Get $