janhoedt
asked on
Sccm sql: query all applications, deploys to collections and foldername
Hi,
I d need a sql query to directly query sccm for all applications with details plus to which collections they are deployed.
I also would like to know in which folder the applications are located (we have some folders named like f.e. test, tophaseout etc).
I can do this via Powershell but it takes me 10 minutes to run the query. Don t need an ssrs report, just need an (almost) instant sql query to the sccm db.
I need to execute it remotely to a sql server (so no wql, don't get the logic why wql is useful anyways).
Found some queries but can t match them together (below).
We have the latest sccm version.
Thanks!
---
What I already found:
Applications
select DateCreated, DateLastModified, DisplayName, Manufacturer, SoftwareVersion, CreatedBy, LastModifiedBy
from fn_ListLatestApplicationCI s(1033)
GROUP BY DateCreated,DateLastModifi ed,Display Name,Manuf acturer,So ftwareVers ion,Create dBy, LastModifiedBy
ORDER BY DateCreated DESC
Packages per folder, but would need applications, not packages:
SELECT v_Package.Name AS [Package Name]
FROM v_Package
JOIN vFolderMembers ON v_package.PackageID = vFolderMembers.InstanceKey
JOIN vSMS_Folders on vFolderMembers.ContainerNo deID = vSMS_Folders.ContainerNode ID
WHERE vSMS_Folders.Name = 'x64'
ORDER BY v_Package.Name
Software deployment per collections
Softwarename,CollectionNam e,Collecti onid,ds
DeploymentTime,NumberSucce ss,NumberI nProgress, NumberErro rs,NumberU nknown,Num berTotal
from v_DeploymentSummary DS
where softwarename <> ' '
group by SoftwareName, collectionname,DeploymentT ime,Number Success,Nu mberInProg ress,Numbe rErrors,Nu mberUnknow n,NumberTo tal,Collec tionid
I d need a sql query to directly query sccm for all applications with details plus to which collections they are deployed.
I also would like to know in which folder the applications are located (we have some folders named like f.e. test, tophaseout etc).
I can do this via Powershell but it takes me 10 minutes to run the query. Don t need an ssrs report, just need an (almost) instant sql query to the sccm db.
I need to execute it remotely to a sql server (so no wql, don't get the logic why wql is useful anyways).
Found some queries but can t match them together (below).
We have the latest sccm version.
Thanks!
---
What I already found:
Applications
select DateCreated, DateLastModified, DisplayName, Manufacturer, SoftwareVersion, CreatedBy, LastModifiedBy
from fn_ListLatestApplicationCI
GROUP BY DateCreated,DateLastModifi
ORDER BY DateCreated DESC
Packages per folder, but would need applications, not packages:
SELECT v_Package.Name AS [Package Name]
FROM v_Package
JOIN vFolderMembers ON v_package.PackageID = vFolderMembers.InstanceKey
JOIN vSMS_Folders on vFolderMembers.ContainerNo
WHERE vSMS_Folders.Name = 'x64'
ORDER BY v_Package.Name
Software deployment per collections
Softwarename,CollectionNam
DeploymentTime,NumberSucce
from v_DeploymentSummary DS
where softwarename <> ' '
group by SoftwareName, collectionname,DeploymentT
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
does that help you? or do you need anything else to add?
ASKER
Your query show collections, my query gets applications but not per folder.
I d need to have the applications with the folder they are in (only 2 rootfolders exist in applications) and the collections they are deployed to.
So how do I match the different queries to 1 query that shows applications (with foldername and other details) and the.collections they are deployed to?
ASKER
Thanks, that's already a part of the solution :-)