Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
AddExtender("wwads34i.dll") AddExtender("wwsop34i.DLL") title = "Check User Logons - v1.00" boxtitle(title) today = TimeYmdHms() days90 = TimeSubtract(today, "0000:00:90:00:00:00") data = "" sAdsiPath="LDAP://rootDSE" ;here sValue=dsGetProperty (sAdsiPath,"defaultNamingContext") ;here sStarPath=StrCat("LDAP://",sValue) ;and here ;sFilter = "(&(objectCategory=Person)(!lastlogon=*))" ;search for empty lastlogon property sFilter = `(&(objectCategory=Person)(lastlogon<=%days90%))` ;search for lastlogon property greated than 90 days old astatusbar(0,title,"Generating AD User List...",0,0) MyOuPaths = dsFindPath(sStarPath, sFilter) y = 0 oucount = itemcount(myoupaths,@tab) for x = 1 to oucount astatusbar(1,title,"Checking User Logons... 90 Day Old",oucount,x) ou = itemextract(x,myoupaths,@tab) objUser = Objectopen(ou) cn = objUser.CN errormode(@off) ll = objUser.lastlogin errormode(@cancel) if ll != 0 then ll = timediffdays(today,ll) lastname = objUser.sn firstname = objUser.givenname parentou = objUser.parent createtimestamp = objUser.createTimeStamp if createtimestamp != "" createdate = timediffdays(today,createTimeStamp) else createdate = "UNDEFINED" endif data = strcat(data,cn,",",lastname,",",firstname,",",parentou,",",ll,@crlf) ObjectClose(objUser) next astatusbar(2,title,"",0,0) logfile = fileopen("c:\Log.txt","write") filewrite(logfile,data) fileclose(logfile) message("","Done!") exit
Article ID: W16085File Created: 2005:04:05:12:23:08Last Updated: 2005:04:05:12:23:08