cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
manelnas
Engaged Sweeper II
Hello I want create a report that show only the PC that have some admin that are not declared in a table or somewhere.
How can do that?
1 REPLY 1
AZHockeyNut
Champion Sweeper III
could you clarify, perhaps an example??

what I think you are saying is you want a report of PC's that have admin accounts that are not within a list of names/groups like (administrator,bob,mark,mary,Infosec,ITGroup) etc. is that what you mean?

This is a complex report that gives you all admins including those granted by group membership, it should get you started, you can use a "not in" type of sub query possibly.



Select Top 1000000 A.AssetID,
A.AssetName,
G.Username As 'User or Group Name',
G.Domainname As 'PC or Domain Name',
V.Username As 'View User Name',
(Case S.ADObjectID When (Select tblADusers.ADObjectID From tblADusers
Where tblADusers.ADObjectID = S.ADObjectID) Then 'USER'
When (Select tblADGroups.ADObjectID From tblADGroups
Where tblADGroups.ADObjectID = S.ADObjectID) Then 'GROUP' Else 'LOCAL'
End) As 'Permissions From',
G.Groupname As 'Local Group Name on Asset'
From tblAssets A
Inner Join tblUsersInGroup G On A.AssetID = G.AssetID
Inner Join tblAssetCustom C On A.AssetID = C.AssetID
Left Outer Join tblADObjects S On S.sAMAccountName = G.Username And
S.domain = G.Domainname
Left Join web50repfec49c298d2a49e3a80f08adbd7347bc V On V.ADGroupID =
S.ADObjectID
Where (G.Groupname Like '%Administrators%' Or
G.Groupname Like '%Remote Desktop Users%') And C.State = 1
Order By A.AssetName