Friday, 22 August 2014

SCCM 2012 Content Library

SCCM Content Library:-

Content Library is a new storage format introduced in System  ConfigMgr 2012 for the content storage. 
By default in SCCM 2012 the contents (source files for Software Updates, Applications, packages) are stored in the distribution points using this new concept. Back in SCCM 2007 in fact since SMS 2.0 the legacy method was used.  The contents were stored in the package ID folder under the SMSPKG shared directory. This has been replaced by the SCCMContentLib folder.  The content Library is also called as single-Instance store, only one instance of each file, regardless of the number package references.

In  ConfigMgr 2007, If a particular file is a part of multiple packages or Package versions , then the copy of the same file is stored in all the reference packages. This will cause disk space issues.
By using Single instance store in SCCM 2012, every file will be stored only once, that means single instance/copy of each file.
Whenever we distribute  a package to a DP. The hash value of each source file will be calculated and if it is already present in the DP. It will just add a reference of the new package. We will see this in detail.


SCCMContentLib consists of three sub folders:-
PkgLib, DataLib and FileLib


PackageLibrary(PkgLib) :- 
Here we will find a 1KB PackageID.INI file for each and every package present in the DP.  This INI file will have the version of the package distributed to the DP

For example, if the package ID is SAP0008, then the INI file name would be SAP0008.INI

DataLibrary(DataLib):- 
As the name suggests  this folder contains the Metadata about each and every package present in the DP.  We can see a PackageID.Version.INI File and a PackageID.Version Folder for every package

  1. PackageID.Version.INI file - This file contains the information such as the hash value of the whole package which is used for validation
  2. PackageID.Version Folder - This folder contains the exact package structure without any real files. For each file in the original package you will see a .INI file which has the information and Pointer to the original file.  If we open the INI file we can see a hash value of the original file. Note down the first four digit of the hash value and you can locate the original file using it in the FileLib folder



File Library(FileLib):- The actual files are present in the FileLib folder. We can locate the files using the hash value which we 








Here is an example of the single instance storage.
Let us consider a package "Test Package 1" which has the following source files.


 


 
Note that the package ID is SAP0009.








SMSPKGSIG folder contains the snapshot of the package. You can notice that  the size of each file is 1KB
These files have the signature information.





Now let's focus on the content Library folder. As discussed the content library has three sub folders :- PkgLib, DataLib and FileLib

PkgLib has  the  INI files  (PackageID.INI) of 1Kb for each  package present in the DP.  In this example, the INI file name is SAP0009.INI





If we open the SAP0009.INI file present in the PkgLib folder we could see the following information such as Package ID and Package version.





Data Lib.

Now let's move to the Data Lib.
Data Lib has two entries for the each package SAP0009.1.  One is a folder and other one is an INI file

First one is an INI file (PackageID.Version.INI) which has the hash value for the whole package. This hash value is used for validation. 

See below the contents on the SAP00009.INI file





Second one is a folder(PackageID.version) which has the exact package structure without the real files.  We can see each source file in the package 

Is represented by an INI file of size 1KB.





The INI file has the following information as shown below.
  • Last Modified
  • Hash Value
  • Size
  • Attributes

Now the actual file can be located using this Hash value in the FileLib folder.





FileLib

FileLib stores the actual files using their hash values.






Let's browse to the folder '64EC'  and take a look at the real files.





If you open the INI file present in the hash folder. We can see the packages  which are linked to this particular file.  In this example File1.txt is a part of SAP00009.1





  


If this file is present in any other packages, then we can see those package IDs also in this INI file.  So this INI file will tell us the packages which have this same source file (in our example , the source file is file1.txt).
Here the actual file is stored only once( "Single Instance Storage"). If any other package has the same source file, it will not be stored again instead it will add a reference to
this hash value. INI file.




 This is all about the content Library in SCCM 2012



By default the source files are stored in the content library. We can also enable the legacy storage method using the below option in the package properties. 
This option can be used for the scenarios  like "installing the package from the network"



Thanks for reading! Happy learning!!!



Friday, 11 July 2014

Extending hardware Inventory in SCCM 2012



 Let's see here how to extend hardware inventory class for the Client Cache

  
By default the Client cache details (Such as Cache Location, Cache Size, Used space) are not captured in the hardware inventory. But we can include it to the hardware inventory by importing the necessary WMI class.
ConfigMgr hardware inventory reads the required information from the Windows Management Instrumentation(WMI).

In the earlier versions of ConfigMgr, we could extend the Hardware inventory by editing the SMS_Def.MOF file on the site server.
In simple words, the sms_def.mof is a text file that tells SMS what client information you are looking for when you run a hardware inventory on a client. This MOF file is stored in the \SMS\Inboxes\Clifiles.src\Hinv folder on the SMS site server.

In ConfigMgr2012, there is no need to edit the SMS_Def.MOF file like the earlier versions.  Instead we can enable and disable WMI classes, Add or Import new classes  to hardware inventory by the Client Settings in the console itself.



As shown below, The Client Cache details are present in the WMI class "CacheConfig" under the namespace Root\CCM\Softmgmtagent\



We can also see the MOF file and the data types of all the properties using the wbemtest. Connect to the names space \\root\ccm\softmgmtagent  then select class "cacheconfig" and click on "show MOF"
  
Same can be explored using PowerShell also:-


Now let's try to import this class to the Hardware inventory.

Create a text file and copy the below content to it. Save the text file as a MOF file. For ex. ClientCache.Mof

====================================================================================================================================
//=====================================
// SMS Advanced Client Cache Reporting Class
//=====================================

[ SMS_Report (TRUE),
  SMS_Group_Name ("SMS Advanced Client Cache"),
  SMS_Class_ID ("SMS_ADVANCED_CLIENT_CACHE"),
  Namespace ("\\\\\\\\.\\\\root\\\\ccm\\\\softmgmtagent") ]
class CacheConfig : SMS_Class_Template
{
    [ SMS_Report (TRUE), key ]
    String     ConfigKey;
    [ SMS_Report (TRUE) ]
    Boolean     InUse;
    [ SMS_Report (TRUE) ]
    String     Location;
    [ SMS_Report (TRUE) ]
    UInt32     Size;
};
=======================================================================================================================================


Start the ConfigMgr Console,  Under the Administration workspace, select the  Client Settings.  You will see the list of client settings which are created in the right pane.
Always select the "Default Client Settings" to import the new classes. You will receive errors if you try import classes to the other customized client settings. The new changes will automatically reflected to other custom client settings.
These changes to "Default Client Setting" should be done at the top level hierarchy of SCCM.

Right Click on the "Default Client Settings" and select properties


 

Select the Hardware Inventory and Click on "Set Classes"



The "Hardware Inventory Classes"  will open. The Client cache class is not present in the Inventory classes list.  Click on Import
 



Browse the MOF file which we had created.

 


Select the file and click open. You will see the summary window as shown below. Click on Import

 

You can check the progress in the dataldr.log under \program files\Microsoft Configuration Manager\logs\ on the site server 


 


Once it is imported successfully,  You would see the "SMS Advanced Client Cache( CacheConfg)" class listed in the Hardware inventory classes 



 

Let's deploy this setting and verify the same on a test machine. 
As i mentioned below the changes in the Default Client Settings will automatically reflect in the other customized client settings.
Here I selected the "SMS Advanced Client Cache (CacheConfig) in the test client settings (Customized one) and deployed the same to a Test machine  "Win7-client1-SA" 

 

Made sure the "CacheConfig" class is selected and deployed to the TestWin7 collection which has the test machine "Win7-Client-SA"
 






Logged on to a Test machine "Win7-Client1-SA" and Initiated the Hardware inventory from the Configuration Manager client applet.


 


Monitor the InventoryAgent.log at c:\windows\ccm\logs on the client machine. You would see the log entries related to CacheConfig class. 



Back to SCCM console, Open the resource explorer for the test machine and you would see the new class populated with the necessary information





     Thanks for reading !
     Happy Exploring!!