SCCM 2012 – Computers with Inactive Client in a Specific Collection

SQL query to list all computers with client status “Inactive” in a specific collection. Just copy it and run on a SQL Management Studio:

Begin
Declare @CollID as varchar(20) = '<collection ID>'
SELECT DISTINCT
    v_R_System.Name0 as 'Hostname',
    v_R_System.Resource_Domain_OR_Workgr0 as 'Domain or Workgroup',
    v_R_System.User_Name0 as'Last User Logged On',
    v_R_System.Last_Logon_Timestamp0 AS 'Last Logon',
    CASE v_R_System.Client0 WHEN 1 THEN 'Installed' END AS 'Client',
    CASE v_CH_ClientSummary.ClientActiveStatus     WHEN 0 THEN 'Inactive' END AS 'Status'
FROM 
    v_R_System 
        inner join v_CH_ClientSummary on v_CH_ClientSummary.ResourceID = v_R_System.ResourceID
        inner join CollectionMembers on CollectionMembers.MachineID = v_R_System.ResourceID
where
    v_CH_ClientSummary.ClientActiveStatus  = 0 and 
    CollectionMembers.SiteID like @CollID
order by 'hostname'
End

Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *