Forum Discussion

Speed1's avatar
Speed1
Copper Contributor
Apr 13, 2022
Solved

KQL - Devices NOT in Computer Groups

Hi, I'm trying to make an KQL Query for all computers that are NOT in 3 certain groups. I tried this but without success. There are always all computers because they are at least in the "Domain Comp...
  • Clive_Watson's avatar
    Clive_Watson
    May 09, 2022

    Speed1 

     

    Maybe this is better?  I build a list of Computers in the 3 groups, then check which computers are not in that list

    let allComputersinGroups = ComputerGroup
    | where Group in ('Domain Controllers','Exchange Servers','fakeGroupName')
    | summarize count() by Computer, Group;
    ComputerGroup
    | where  Computer !in (allComputersinGroups)
    | summarize dcount(Computer),make_set(Computer) 

      

Resources