Query to see all packages in a folder
Hi all, I am having trouble with what I think is a basic query. In SCCM I have a few folders underneath packages. I am trying to query those folders to see the packages within. I can query all of the folders by querying dbo.folders.name however when I try to search for the packages within, it returns every package in SCCM. Here is what I am using to search for all packages in the 'x64' folder: SELECT v_Package.Name AS [Package Name] FROM v_Package JOIN dbo.Folders ON v_package.SourceSite = dbo.folders.SourceSite WHERE dbo.folders.Name = 'x64' ORDER BY v_Package.Name
July 30th, 2012 11:36pm

You are using a wrong query, this one should work: SELECT v_Package.Name AS [Package Name] FROM v_Package JOIN vFolderMembers ON v_package.PackageID = vFolderMembers.InstanceKey JOIN vSMS_Folders on vFolderMembers.ContainerNodeID = vSMS_Folders.ContainerNodeID WHERE vSMS_Folders.Name = 'x64' ORDER BY v_Package.Name
Free Windows Admin Tool Kit Click here and download it now
August 1st, 2012 4:23am

You may also create a search folder for e.g. All Packages & specify search folder criteria as Name: % and check mark search all folders under this feature. This will list all the packages & you can look specific package from look for section.Prashant Patil
August 1st, 2012 4:32am

thanks jdulongc. That did the trick. Just curious, how did you know that FolderMembers.InstanceKey was the right table?
Free Windows Admin Tool Kit Click here and download it now
August 1st, 2012 11:52am

When you use the SCCM console all operations are logged in smsprov.log located on your site server (actually SMS provider server). So open a console, click on a folder in package node for example, and check in the same time smsprov.log you will see the WQL and SQL query used to display the information in the console, so you can can find queries and views where your information is stored in the database. Julien
August 1st, 2012 12:20pm

Awesome trick. Thank you!
Free Windows Admin Tool Kit Click here and download it now
August 1st, 2012 12:51pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics