And where is the error. Not sure why you have so many objects. Usually all directory entries have the AccountExpires attribute. A few questions: where is directorySearch2 pointing to ?. The accountExpires is set in AD ticks, you need to convert it to date. There is a simple function for this.