SCCM Report All Installed Software

I have an audit comming up and I would like to create a custom dash board for the auditors.  This way they could find the info that they are looking for direclty.  

One of the reports that we will be giving them is the Count of all instances of software registered with Add or Remove Programs.  The problem with this report is that it prompts you to enter in the group that you would like to run it against.  This does not work for dashboards.  

I want to copy the report and change the sql query in order to give it the name of the group as opposed to prompting for it.  

I cannot figure out how to do this.  I will copy the code bellow and the group I want to run it against is Collection ID SMS000ES.  If someone could help and explain what they are doing, I hopefully will be able to grasp this and apply it to other reports that they will want.  

Thanks
SELECT DisplayName0, Count(*) AS 'Count', Publisher0, Version0, @CollID as CollectionID
FROM v_Add_Remove_Programs arp
JOIN v_FullCollectionMembership fcm on arp.ResourceID=fcm.ResourceID 
WHERE fcm.CollectionID = @CollID
GROUP BY DisplayName0, Publisher0, Version0 
ORDER BY Publisher0, Version0

Open in new window

tdisalvoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

socrates2012Commented:
From the SQL edit screen look to the right and you will see a Prompts button.  Clicking it will show you the variable for CollID and side query used to look up those values.  If you want to just hardcode in a particular collection you can delete that prompt and then here is the fixed SQL query:

 SELECT DisplayName0, Count(*) AS 'Count', Publisher0, Version0, @CollID as CollectionID
FROM v_Add_Remove_Programs arp
JOIN v_FullCollectionMembership fcm on arp.ResourceID=fcm.ResourceID
WHERE fcm.CollectionID = SMS000ES
GROUP BY DisplayName0, Publisher0, Version0
ORDER BY Publisher0, Version0
 
socrates2012Commented:
Oops, remove the "@CollID as CollectionID" from the SELECT line too
tdisalvoAuthor Commented:
OK, I made the adjustments as listed and we are now getting the following error.  I did remove the Prompt as well and that part did work.  

An error occurred when the report was run. The details are as follows:
Invalid column name 'SMS000ES'.
Error Number: -2147217900
Source: Microsoft OLE DB Provider for SQL Server
Native Error: 207

I will copy the code bellow

SELECT DisplayName0, Count(*) AS 'Count', Publisher0, Version0, 
FROM v_Add_Remove_Programs arp
JOIN v_FullCollectionMembership fcm on arp.ResourceID=fcm.ResourceID 
WHERE fcm.CollectionID = SMS000ES
GROUP BY DisplayName0, Publisher0, Version0 
ORDER BY Publisher0, Version0

Open in new window

Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

socrates2012Commented:
May want to verify that the collection you are trying to run this report against is truly called SMS000ES.  Right click on the collection and view properties.  Rename in the query accordingly.
tdisalvoAuthor Commented:
Nope defiantly SMS000ES.  Any other thoughts?  Your help is defiantly appreciated.  
1.jpg
socrates2012Commented:
Put single, possibly double, quotes around the collection ID name.
matrixnzCommented:
Hi tdisalvo

You must declare the @CollID as this is a linked report, remove the prompt as socrates suggested and then use the following in your SQL Query.

Cheers
Declare @CollID char(8)
Set @CollID = 'SMS000ES'

SELECT DisplayName0, Count(*) AS 'Count', Publisher0, Version0, @CollID as CollectionID
FROM v_Add_Remove_Programs arp
JOIN v_FullCollectionMembership fcm on arp.ResourceID=fcm.ResourceID 
WHERE fcm.CollectionID = @CollID
GROUP BY DisplayName0, Publisher0, Version0 
ORDER BY Publisher0, Version0

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tdisalvoAuthor Commented:
Big thanks to everyone for helping me out.  
tyconz_helpdesk2008Commented:
Hi
How would i add netbios name as well to the report above

thanks in advance
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Server OS

From novice to tech pro — start learning today.