Jump to content

Recommended Posts

Posted
I'm Trying to get all computers returned in the active domain that have been active within the last 90 days, I'm currently stuck at just getting the full list of computers in the domain.
I'm using the ADfunctions UDF.
 
Here's my code:
 
 
#include "XXX/ADfunctions.au3"




_GetADComputers()


Func _GetADComputers()


Local $aComputers
$sOU = $strDNSDomain
_ADGetObjectsInOU($aComputers,$sOU,"(objectclass=computer)",2,"name")
_ArrayDisplay($aComputers)
Return($aComputers)


EndFunc
 
 
Any help is greatly appreciated! :)
Posted

This query from the _AD_GetobjectsInOU.au3 should be a good starting point:

"(&(&(objectCategory=person)(objectClass=user))(|(lastLogon=0)(!(lastLogon=*))))"

Can't test at the moment but I think this should work:

$sDate _DateAdd("D", _NowCalc(), -90)
(|(lastLogon=0)(lastLogon<=" $sSdate & "))

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 3/31/2014 at 7:19 PM, water said:

 

This query from the _AD_GetobjectsInOU.au3 should be a good starting point:

"(&(&(objectCategory=person)(objectClass=user))(|(lastLogon=0)(!(lastLogon=*))))"

Can't test at the moment but I think this should work:

$sDate _DateAdd("D", _NowCalc(), -90)
(|(lastLogon=0)(lastLogon<=" $sSdate & "))

Not quite sure where to insert your code into my function..

Posted

Should list all users that never logged on or have logged on 90 or more days ago.

$sDate _DateAdd("D", _NowCalc(), -90)
_ADGetObjectsInOU($aComputers,$sOU,"(|(lastLogon=0)(lastLogon>=" $sSdate & "))",2,"name")

UNTESTED! Not sure it works because I can't test at the moment.

Maybe tomorrow or the day after tomorrow.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Another try:

$sDate _DateAdd("D", _NowCalc(), -90)
_ADGetObjectsInOU($sOU,"(&(objectClass=user)(|(lastLogon=0)(lastLogon>=" $sSdate & ")))",2,"name")

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

I just checked and I think it is more complex. Check function _AD_GetLastLoginDate.

I will need to check when I'm in my office again.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

I think the function described >here solves your problem.

My UDFs and Tutorials:

  Reveal hidden contents

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...