How to create a SCCM 2012 reports for all programs registerein add/remove?

This is using MS SCCM 2012 R2 server. The reporting service point was installed and SRSS is working fine. I know that in monitoring > reporting > reports, there is a report called " All program in add/remove for specific computer. Please see the query:

 Select v_Add_Remove_Programs_Alias.DisplayName0, v_Add_Remove_Programs_Alias.Publisher0, v_Add_Remove_Programs_Alias.Version0
FROM fn_rbac_Add_Remove_Programs(@UserSIDs) v_Add_Remove_Programs_Alias  
JOIN  fn_rbac_R_System(@UserSIDs) v_R_System_Alias ON v_Add_Remove_Programs_Alias.ResourceID = v_R_System_Alias.ResourceID  
WHERE v_R_System_Alias.Netbios_Name0 = @computername

However, how to modify to prompt for "collectionID" instead computername, so as, all programs of all computers in the collection is diplaying? Please show step-by-step.

Thanks in advance.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Benjamin VoglarIT ProCommented:
Here is a Querry how to get all SW in a collection:

Select DISTINCT SYS.Netbios_Name0,SYS.Resource_Domain_OR_Workgr0,SP.CompanyName, SP.ProductName, SP.ProductVersion

FROM v_GS_SoftwareProduct SP

JOIN v_R_System SYS ON SP.ResourceID=SYS.ResourceID

JOIN v_FullCollectionMembership fcm on sys.ResourceID=fcm.ResourceID 

WHERE fcm.CollectionID = ‘<CollectionID>’

ORDER By SYS.Netbios_Name0, SP.CompanyName, SP.ProductName, SP.ProductVersion

Open in new window

(replace <CollectionID> with your actual collection name)

Here is, how to do this with prompt:

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
MichaelBalackAuthor Commented:
Excellent, Benjamin's suggested solved my problem.
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

From novice to tech pro — start learning today.