我想在SCCM中为用户集合编写查询。 我们的IT部门希望每个软件包使用三个不同的用户集合:
基本上系统如下:
我知道可以通过"监控"跟踪安装状态。但我想提出上述解决方案。
问题:我在编写"已安装"的问题时遇到问题。组。我的代码段如下:
select
SMS_R_USER.ResourceID,SMS_R_USER.ResourceType,SMS_R_USER.Name,SMS_R_USER.UniqueUserName,SMS_R_USER.WindowsNTDomain
from
SMS_R_User
where
SMS_R_User.SecurityGroupName = "DOMAIN\\GROUP"
到目前为止它正在运行,我现在添加了产品检索查询的部分:
and
select
SMS_R_System_ADD_REMOVE_PROGRAMS.ProdID
from
SMS_R_System_ADD_REMOVE_PROGRAMS
where
SMS_R_System_ADD_REMOVE_PROGRAMS.ProdID
like
"{PRODUCTCODE}"
此部分无法正常工作,我在SCCM设计视图中遇到了#34;语法错误或不支持查询"。我很清楚可能存在语法错误,但我也感觉用户集合查询设计中不支持SMS_R_System。我是SQL的新手,但我希望得到一些提示。 谢谢!
编辑:使用SCCM 1710
答案 0 :(得分:0)
自己解决了:
广告组中的用户在设备上安装了软件
select
SMS_R_User.UniqueUserName, SMS_R_System.name,SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName, SMS_G_System_ADD_REMOVE_PROGRAMS.ProdID,SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName, SMS_G_System_ADD_REMOVE_PROGRAMS_64.ProdID
from SMS_R_System
INNER JOIN SMS_UserMachineRelationship ON SMS_UserMachineRelationship.ResourceId = SMS_R_System.ResourceId
INNER JOIN SMS_R_User ON SMS_UserMachineRelationship.UniqueUserName = SMS_R_User.UniqueUserName
LEFT OUTER JOIN SMS_G_System_ADD_REMOVE_PROGRAMS ON SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId AND SMS_G_System_ADD_REMOVE_PROGRAMS.ProdID = "{1441FE72-8D71-4B05-B89F-8C3DA0D2D3A6}"
LEFT OUTER JOIN SMS_G_System_ADD_REMOVE_PROGRAMS_64 ON SMS_G_System_ADD_REMOVE_PROGRAMS_64.ResourceID = SMS_R_System.ResourceId AND SMS_G_System_ADD_REMOVE_PROGRAMS_64.ProdID = "{1441FE72-8D71-4B05-B89F-8C3DA0D2D3A6}"
where (SMS_R_User.SecurityGroupName = "BAMBEL\\SCM_TST_BVO")
AND
SMS_UserMachineRelationship.Types = 1
AND
( SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName <> "" OR SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName <> "" OR SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName <> NULL OR SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName <> NULL)
AD GROUP中的用户未在设备上安装软件
select
SMS_R_User.UniqueUserName, SMS_R_System.name,SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName, SMS_G_System_ADD_REMOVE_PROGRAMS.ProdID,SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName, SMS_G_System_ADD_REMOVE_PROGRAMS_64.ProdID
from SMS_R_System
INNER JOIN SMS_UserMachineRelationship ON SMS_UserMachineRelationship.ResourceId = SMS_R_System.ResourceId
INNER JOIN SMS_R_User ON SMS_UserMachineRelationship.UniqueUserName = SMS_R_User.UniqueUserName
LEFT OUTER JOIN SMS_G_System_ADD_REMOVE_PROGRAMS ON SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId AND SMS_G_System_ADD_REMOVE_PROGRAMS.ProdID = "{1441FE72-8D71-4B05-B89F-8C3DA0D2D3A6}"
LEFT OUTER JOIN SMS_G_System_ADD_REMOVE_PROGRAMS_64 ON SMS_G_System_ADD_REMOVE_PROGRAMS_64.ResourceID = SMS_R_System.ResourceId AND SMS_G_System_ADD_REMOVE_PROGRAMS_64.ProdID = "{1441FE72-8D71-4B05-B89F-8C3DA0D2D3A6}"
where (SMS_R_User.SecurityGroupName = "BAMBEL\\SCM_TST_BVO")
AND
SMS_UserMachineRelationship.Types = 1
AND
( SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName IS NULL AND SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName IS NULL)