SCCM Query for machines with a specific OS with specific software in Add Remove Programs
I'm trying to write a query to allow me to search on computers that have a specific OS which contains specific software in Add/Remove Programs
Select SYS.Netbios_Name0, OPSYS.Caption0 as C054, arp.DisplayName0 from v_R_System SYS join v_GS_OPERATING_SYSTEM OPSYS ON SYS.ResourceID=OPSYS.ResourceID join v_Add_Remove_Programs arp ON SYS.ResourceID=arp.ResourceID WHERE Caption0=@os
and DisplayName0=@displayname
When I try and click on the button in the actual report page, it doesn't query against anything and give me value's to select. What am i missing?
Thanks
Jason
December 29th, 2010 12:13pm
Untested but something like this....
SELECT dbo.v_R_System.Name0, dbo.v_GS_OPERATING_SYSTEM.Caption0
FROM dbo.v_R_System
INNER JOIN dbo.v_GS_OPERATING_SYSTEM ON dbo.v_R_System.ResourceID = dbo.v_GS_OPERATING_SYSTEM.ResourceID
WHERE (dbo.v_GS_OPERATING_SYSTEM.Caption0 = 'Microsoft Windows XP Professional') and resourceID in (SELECT DisplayName0
FROM dbo.v_GS_ADD_REMOVE_PROGRAMS
WHERE (DisplayName0 = 'MY app')
John Marcum | http://myitforum.com/cs2/blogs/jmarcum/|
Free Windows Admin Tool Kit Click here and download it now
December 29th, 2010 12:18pm
Hi Jason,
The query is using two prompted values @OS and @displayname, you need to define theese before you can use the report. To test the report you can change the prompts with a fixed value like this:
SELECT SYS.Netbios_Name0, OPSYS.Caption0 AS C054, arp.DisplayName0
FROM dbo.v_R_System AS SYS INNER JOIN
dbo.v_GS_OPERATING_SYSTEM AS OPSYS ON SYS.ResourceID = OPSYS.ResourceID INNER JOIN
dbo.v_Add_Remove_Programs AS arp ON SYS.ResourceID = arp.ResourceID
WHERE (OPSYS.Caption0 = 'Microsoft Windows Server 2008 R2 Standard') AND (arp.DisplayName0 = 'ConfigMgr 2007 Toolkit V2')
You can see how to create a prompted report here -
http://blog.coretech.dk/confmgr07/config-mgr-inventory-and-reporting/creating-configuration-manager-2007-reports-part-iv-using-prompt/Kent Agerlund | My blogs: http://blog.coretech.dk/author/kea/ and http://scug.dk/ | Twitter @Agerlund | Linkedin: /kentagerlund
December 29th, 2010 12:24pm