Solved

SCCM 2012 query

Posted on 2014-02-20
1
1,113 Views
Last Modified: 2014-03-07
Can someone assist me in writing a query or report in SCCM 2012 that will show how many Task Sequence a certain software/driver package is a member of?
I.e driver package ID A10030A is a member of task sequence A0100311, A0100259 and so forth.
0
Comment
Question by:Risrollout
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 8

Accepted Solution

by:
Leon Taljaard earned 500 total points
ID: 39876042
Hi there

Here is a query that I use

DECLARE @Path AS varchar(2000)
 DECLARE @ObjectType AS int

;
 WITH folCTE (row, ContainerNodeID, Name, parentContainerNodeID,ObjectType)
 AS
 (
 SELECT
 1
 ,ContainerNodeID
 ,Name
 ,parentContainerNodeID
 ,ObjectType
 FROM
 dbo.Folders
 WHERE
 (ContainerNodeID IN (SELECT ContainerNodeID FROM dbo.FolderMembers WHERE InstanceKey = @PackageID))
 AND
 (ObjectType NOT IN (7,8))

UNION ALL
 SELECT
 cte.row + 1
 ,f.ContainerNodeID
 ,f.Name
 ,f.parentContainerNodeID
 ,f.ObjectType
 FROM
 dbo.Folders f
 INNER JOIN
 folCTE cte ON cte.parentContainerNodeID = f.ContainerNodeID
 )

SELECT @Path = COALESCE(@Path + ' -> ', '') + Name from folCTE ORDER BY row DESC

SELECT @ObjectType = ObjectType FROM dbo.Folders WHERE ContainerNodeID IN (SELECT ContainerNodeID FROM dbo.FolderMembers WHERE InstanceKey = @PackageID) AND (ObjectType NOT IN (7,8))

SELECT
 @PackageID AS 'PackageID'
,pkg.Manufacturer  + ' ' + pkg.Name + ' ' + pkg.Version AS 'Package'
,CASE
 WHEN @ObjectType = 2 THEN 'Software Distribution\Packages\' + @Path
 WHEN @ObjectType = 14 THEN 'Operating System Deployment\Operating System Install Packages\' + @Path
 WHEN @ObjectType = 18 THEN 'Operating System Deployment\Operating System Images\' + @Path
 WHEN @ObjectType = 19 THEN 'Operating System Deployment\Boot Images\' + @Path
 WHEN @ObjectType = 20 THEN 'Operating System Deployment\Task Sequences\' + @Path
 WHEN @ObjectType = 23 THEN 'Operating System Deployment\Driver Packages\' + @Path
 WHEN @ObjectType = 25 THEN 'Operating System Deployment\Drivers\' + @Path
 ELSE @Path
 END AS 'Path'
FROM
 v_Package pkg
 WHERE
 PackageID = @PackageID

Open in new window


You can just create a report from it with the "PackageID" as a parameter and you will be able to get the path for the specific package.

Hope that helps
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question