SCCM 如何在此代码中添加计算机名称?

SCCM How can I add Computer Name in this code?

代码的目的;在系统中心的计算机上列出 viruses/threats。但是我无法在此代码中添加计算机名。它不会工作。我们应该怎么做?

Select distinct 

t.DetectionID,
t.DetectionTime,
IsNULL(tc.Name,t.ThreatName) as ThreatName, 
cat.Category,
sev.Severity,
t.PendingActions,
t.Process,
t.UserName,
t.Path,
t.CleaningAction,
t.ActionSuccess,
t.DetectionSource

from fn_rbac_R_System(@UserSIDs)  s 
join fn_rbac_GS_Threats(@UserSIDs)  t on s.ResourceID=t.ResourceID
left join fn_rbac_ThreatCatalog(@UserSIDs)  tc on t.ThreatID=tc.ThreatID
left join fn_rbac_ThreatSeverities(@UserSIDs)  sev on tc.SeverityID=sev.SeverityID 
left join fn_rbac_ThreatCategories(@UserSIDs)  cat on tc.CategoryID=cat.CategoryID

where t.DetectionID <> 'Null'

order by t.DetectionTime DESC

与函数 fn_rbac_R_System(和基础视图 v_R_System)中的 fn_rbac_GS_Threats 相比,大多数列都以尾随 0 命名,因此 属性 你是在 fn_rbac_R_System 中寻找的是 Name0。 (我认为这是因为通常这些视图由不同的数据源组成,并且为了防止多个列具有相同的名称,即使在名称已经是唯一的情况下,名称也总是被索引)。

所以在你的例子中它需要是:

Select distinct 

s.Name0,
t.DetectionID,
t.DetectionTime,
IsNULL(tc.Name,t.ThreatName) as ThreatName, 
cat.Category,
sev.Severity,
t.PendingActions,
t.Process,
t.UserName,
t.Path,
t.CleaningAction,
t.ActionSuccess,
t.DetectionSource

from fn_rbac_R_System(@UserSIDs)  s 
join fn_rbac_GS_Threats(@UserSIDs)  t on s.ResourceID=t.ResourceID
left join fn_rbac_ThreatCatalog(@UserSIDs)  tc on t.ThreatID=tc.ThreatID
left join fn_rbac_ThreatSeverities(@UserSIDs)  sev on tc.SeverityID=sev.SeverityID 
left join fn_rbac_ThreatCategories(@UserSIDs)  cat on tc.CategoryID=cat.CategoryID

where t.DetectionID <> 'Null'

order by t.DetectionTime DESC