Home
%3CLINGO-SUB%20id%3D%22lingo-sub-377233%22%20slang%3D%22en-US%22%3EAuditing%20Software%20Inventory%20Rules%20in%20System%20Center%202012%20Configuration%20Manager%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-377233%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3E%20First%20published%20on%20TECHNET%20on%20May%2019%2C%202012%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EI%20recently%20conducted%20an%20audit%20of%20all%20software%20inventory%20rules%20set%20within%20the%20various%20environments%20my%20team%20manages.%20I%20wanted%20to%20perform%20this%20audit%20for%20several%20reasons%3B%20one%20of%20which%20was%20to%20ensure%20there%20were%20no%20%E2%80%9C*.exe%E2%80%9D%20rules%20still%20lingering%20in%20any%20environment.%20%3A-)%20In%20this%20blog%20I%E2%80%99ll%20show%20how%20much%20easier%20this%20is%20in%20System%20Center%202012%20Configuration%20Manager%20as%20opposed%20to%20Configuration%20Manager%202007.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20you%20may%20already%20know%2C%20the%20sitectrl%20file%20doesn%E2%80%99t%20live%20in%20the%20file%20system%20in%20System%20Center%202012%20Configuration%20Manager.%20It%20lives%20in%20the%20database%20and%20is%20replicated%20via%20SQL%20to%20all%20sites.%20This%20alone%20makes%26nbsp%3BSystem%20Center%202012%20Configuration%20Manager%20easier%20to%20manage%20software%20inventory%20rules%20because%20you%20no%20longer%20have%20to%20update%20the%20rules%20on%20every%20site%20within%20your%20environment.%20Now%20you%20simply%20make%20the%20change%20on%20any%20site%20and%20the%20information%20is%20sent%20to%20all%20other%20sites.%20Thus%2C%20in%20my%20System%20Center%202012%20Configuration%20Manager%20environments%20I%20don%E2%80%99t%20have%20to%20create%20another%20audit%20to%20ensure%20all%20sites%20have%20the%20same%20rules%20configured%20as%20I%20do%20for%20my%20Configuration%20Manager%202007%20environments.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOne%20thing%20to%20know%20about%20me%20is%20that%20I%20really%20like%20seeing%20data%20in%20tables%20(or%20spreadsheets)%20%E2%80%93%20the%20data%20is%20nicely%20laid%20out%20and%20the%20information%20is%20straight%20forward%20and%20easy%20to%20read.%20Therefore%2C%20I%20find%20audits%20much%20easier%20to%20perform%20if%20I%20have%20a%20spreadsheet%20to%20look%20at%20and%20reference.%20So%20when%20I%20performed%20this%20recent%20software%20inventory%20rules%20audit%20I%20captured%20the%20data%20into%20spreadsheets.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20Configuration%20Manager%202007%20environments%20were%20certainly%20not%20the%20easiest%20on%20which%20to%20perform%20this%20action.%20Besides%20the%20numerous%20sites%20to%20compare%20and%20look%20at%2C%20it%20required%20a%20lot%20of%20copying%20and%20pasting%20of%20the%20information%20from%20the%20Admin%20UI%20or%20the%20sitectrl%20file.%20This%20is%20a%20tedious%20task%20(assuming%20you%20have%20several%20rules%20defined).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20System%20Center%202012%20Configuration%20Manager%20I%20could%20get%20the%20information%20the%20same%20way%20%E2%80%93%20I%20could%20use%20the%20Admin%20UI%20or%20display%20the%20sitectrl%20file%20from%20the%20database%20(SELECT%20SiteControl%20FROM%20vSMS_SC_SiteControlXML%20WHERE%20SiteCode%20%3D%20'YourSiteCodeHere').%20I%20could%20do%20that%2C%20but%20why%20would%20I%20want%20to%20if%20I%20can%20simply%20query%20the%20database%20and%20have%20the%20software%20inventory%20rules%20displayed%20in%20a%20nice%2C%20neat%2C%20beautiful%20table%3F%20Here%E2%80%99s%20how%20to%20query%20the%20rules%3A%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CCODE%3E%0A%20%20%20--%20View%20the%20Site%20Control%20File%20information%20for%20Software%20Inventory%20Rules%20in%20table%20format%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20SELECT%20MAX(CASE%20WHEN%20pvt.%5BOption%5D%20%3D%20'Inventoriable%20Types'%20THEN%20pvt.Value%20END)%20AS%20%5BFileName%5D%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20%2CMAX(CASE%20WHEN%20pvt.%5BOption%5D%20%3D%20'Path'%20THEN%20pvt.Value%20END)%20AS%20%5BPath%5D%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20%2CMAX(CASE%20WHEN%20pvt.%5BOption%5D%20%3D%20'Subdirectories'%20THEN%20pvt.Value%20END)%20AS%20%5BSearch%20Subfolers%5D%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20%2CMAX(CASE%20WHEN%20pvt.%5BOption%5D%20%3D%20'Exclude'%20THEN%20pvt.Value%20END)%20AS%20%5BExclude%20Encrypted%20and%20Compressed%20files%5D%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20%2CMAX(CASE%20WHEN%20pvt.%5BOption%5D%20%3D%20'Exclude%20Windir%20and%20Subfolders'%20THEN%20pvt.Value%20END)%20AS%20%5BExclude%20files%20in%20the%20Windows%20folder%5D%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20FROM%20(%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20SELECT%20swi.SiteCode%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20%2Cnds.col.value('%40Name%5B1%5D'%2C'nvarchar(2000)')%20AS%20%5BOption%5D%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20%2Crow.val.value('.'%2C%20'nvarchar(2000)')%20AS%20%5BValue%5D%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20%2CROW_NUMBER()%20OVER%20(PARTITION%20BY%20swi.SiteCode%2C%20nds.col.value('%40Name%5B1%5D'%2C'nvarchar(2000)')%20ORDER%20BY%20(SELECT%200))%20AS%20%5BRowNum%5D%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20FROM%20dbo.vSMS_SC_ClientComponent_SDK%20swi%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20--%20Only%20get%20the%20CAS%20info%20as%20the%20Primaries%20do%20not%20matter!%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20INNER%20JOIN%20dbo.ServerData%20srv%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20ON%20swi.SiteCode%20%3D%20srv.SiteCode%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20AND%20srv.ID%20%3D%200%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20CROSS%20APPLY%20swi.RegMultiStringList.nodes('%2F%2FRegMultiStringLists%2FRegMultiStringList')%20nds(col)%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20CROSS%20APPLY%20nds.col.nodes('Value')%20row(val)%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20WHERE%20swi.ClientComponentName%20%3D%20'Software%20Inventory%20Agent'%20--%20Only%20get%20Software%20Inventory%20Rules%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20)%20pvt%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20GROUP%20BY%20pvt.RowNum%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20ORDER%20BY%20pvt.RowNum%3B%0A%20%20%20%3CBR%20%2F%3E%0A%20%20%20GO%0A%20%20%3C%2FCODE%3E%20%3C%2FP%3E%0A%3CP%3EAs%20you%20can%20see%2C%20System%20Center%202012%20Configuration%20Manager%20makes%20performing%20audits%20of%20software%20inventory%20rules%20much%20easier%20because%20of%20the%20fact%20that%20the%20sitectrl%20file%20is%20stored%20in%20the%20database%20and%20replicated.%20I%20perform%20quarterly%20audits%20of%20the%20software%20inventory%20rules%20as%20well%20as%20software%20metering%20and%20hardware%20inventory%20rules%20to%20minimize%20client%20impact%20and%20network%20usage.%20Now%2C%20you%20can%20use%20this%20query%20to%20help%20ensure%20you%20are%20following%20the%20best%20practices%20of%20software%20inventory%20rules%20and%20minimize%20client%20impact%20in%20your%20environment!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-377233%22%20slang%3D%22en-US%22%3E%3CP%3EFirst%20published%20on%20TECHNET%20on%20May%2019%2C%202012%20I%20recently%20conducted%20an%20audit%20of%20all%20software%20inventory%20rules%20set%20within%20the%20various%20environments%20my%20team%20manages.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-377233%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Econfigmgr%202012%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Emsit%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Eoperations%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ereporting%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESCCM%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESQL%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Esystem%20center%202012%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESystem%20Center%20Configuration%20Manager%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

First published on TECHNET on May 19, 2012

I recently conducted an audit of all software inventory rules set within the various environments my team manages. I wanted to perform this audit for several reasons; one of which was to ensure there were no “*.exe” rules still lingering in any environment. :-) In this blog I’ll show how much easier this is in System Center 2012 Configuration Manager as opposed to Configuration Manager 2007.

 

As you may already know, the sitectrl file doesn’t live in the file system in System Center 2012 Configuration Manager. It lives in the database and is replicated via SQL to all sites. This alone makes System Center 2012 Configuration Manager easier to manage software inventory rules because you no longer have to update the rules on every site within your environment. Now you simply make the change on any site and the information is sent to all other sites. Thus, in my System Center 2012 Configuration Manager environments I don’t have to create another audit to ensure all sites have the same rules configured as I do for my Configuration Manager 2007 environments.

 

One thing to know about me is that I really like seeing data in tables (or spreadsheets) – the data is nicely laid out and the information is straight forward and easy to read. Therefore, I find audits much easier to perform if I have a spreadsheet to look at and reference. So when I performed this recent software inventory rules audit I captured the data into spreadsheets.

 

The Configuration Manager 2007 environments were certainly not the easiest on which to perform this action. Besides the numerous sites to compare and look at, it required a lot of copying and pasting of the information from the Admin UI or the sitectrl file. This is a tedious task (assuming you have several rules defined).

 

In System Center 2012 Configuration Manager I could get the information the same way – I could use the Admin UI or display the sitectrl file from the database (SELECT SiteControl FROM vSMS_SC_SiteControlXML WHERE SiteCode = 'YourSiteCodeHere'). I could do that, but why would I want to if I can simply query the database and have the software inventory rules displayed in a nice, neat, beautiful table? Here’s how to query the rules:


-- View the Site Control File information for Software Inventory Rules in table format
SELECT MAX(CASE WHEN pvt.[Option] = 'Inventoriable Types' THEN pvt.Value END) AS [FileName]
,MAX(CASE WHEN pvt.[Option] = 'Path' THEN pvt.Value END) AS [Path]
,MAX(CASE WHEN pvt.[Option] = 'Subdirectories' THEN pvt.Value END) AS [Search Subfolers]
,MAX(CASE WHEN pvt.[Option] = 'Exclude' THEN pvt.Value END) AS [Exclude Encrypted and Compressed files]
,MAX(CASE WHEN pvt.[Option] = 'Exclude Windir and Subfolders' THEN pvt.Value END) AS [Exclude files in the Windows folder]
FROM (
SELECT swi.SiteCode
,nds.col.value('@Name[1]','nvarchar(2000)') AS [Option]
,row.val.value('.', 'nvarchar(2000)') AS [Value]
,ROW_NUMBER() OVER (PARTITION BY swi.SiteCode, nds.col.value('@Name[1]','nvarchar(2000)') ORDER BY (SELECT 0)) AS [RowNum]
FROM dbo.vSMS_SC_ClientComponent_SDK swi
-- Only get the CAS info as the Primaries do not matter!
INNER JOIN dbo.ServerData srv
ON swi.SiteCode = srv.SiteCode
AND srv.ID = 0
CROSS APPLY swi.RegMultiStringList.nodes('//RegMultiStringLists/RegMultiStringList') nds(col)
CROSS APPLY nds.col.nodes('Value') row(val)
WHERE swi.ClientComponentName = 'Software Inventory Agent' -- Only get Software Inventory Rules
) pvt
GROUP BY pvt.RowNum
ORDER BY pvt.RowNum;
GO

As you can see, System Center 2012 Configuration Manager makes performing audits of software inventory rules much easier because of the fact that the sitectrl file is stored in the database and replicated. I perform quarterly audits of the software inventory rules as well as software metering and hardware inventory rules to minimize client impact and network usage. Now, you can use this query to help ensure you are following the best practices of software inventory rules and minimize client impact in your environment!