Neo4j – AD-Account mit Activ und lastlogin / Tokensize

MATCH (n:ADAccount) where n.type='person' and not n.objectSID='S-1-5-11' 
and not n.objectSID='S-1-1-0' and not n.domain='local' with distinct n 
match (n)<-[:rel_member*..]-(g) where not g.grouptype=
'Universal_Distribution_Group' and not g.grouptype='BuiltIn_Group' and not 
g.grouptype='Local_Distribution_Group' and not g.grouptype='Global_Distribution_Group' 
with distinct n, g, toFloat(n.lastLogon) AS lastLogon, toFloat(n.lastLogonTimeStamp) 
AS LastLogonTS, toFloat(n.accountExpires) AS AccountExpires, n.distinguishedname 
AS Distinguishedname,n.isactive AS activ RETURN id(n), AS name, case when 
lastLogon > 0 and lastLogon < 9223372036854770000 then lastLogon/(8.64*10^11) - 
109205 End as LastLogon ,case when LastLogonTS > 0 and LastLogonTS 
< 9223372036854770000 then LastLogonTS/(8.64*10^11) - 109205 End as 
LastLogonTS, case when AccountExpires > 0 and AccountExpires < 
9223372036854770000 then AccountExpires/(8.64*10^11) - 109205 else "Account 
never expire" End as AccountExpires, activ, Distinguishedname, count(distinct g) 
as Gruppen, (1200 + sum( case when g.grouptype='Global_Security_Group' then 8 when 
g.grouptype='Local_Security_Group' then 40 when g.grouptype='Universal_Security_Group' 
then case when g.domain = n.domain then 8 else 40 end end))as Tokensize order by 
Tokensize desc


Permanentlink zu diesem Beitrag: