Wednesday, June 4, 2014

Mz Computers - Understanding the Configuration Manager Content Library

The redirecting page will be displayed and immediately replaced by “MzComputers.com”. With this zero-delay, many users will not even notice the presence of the redirecting page.

Introduction

The content library is a new concept that was introduced in System Center 2012 Configuration Manager.  In a nut-shell, the content library stores all the Configuration Manager content efficiently on the disk.  If the same file is part of two different packages, it stores only one copy in the content library.  However, references are kept indicating that the file is part of both the packages.
The focus of this blog is to provide more insights on what happens behind the scenes and help Configuration Manager users and administrators to understand the concept better.
Note: The content library is also known as the “single-instance store”, referring to the single instance of any particular file.

Rationale for the Content Library

The rationale for content library is to optimize disk storage and to avoid distributing a file that already exists on the distribution points.
If two different packages each contain a particular file that is identical (even if the file names are different), only one copy of this file will be stored by the content library.  This minimizes the disk space consumption.
When distributing a package, we first analyze all the files in that package. If a file to be distributed is already present on the distribution point as part of another package or part of a previous version of the same package, that file is not copied to the distribution point.  Instead, we add a mapping reference between that file and the new package that we are distributing. This helps reduce the network traffic by not copying files that already exist.  Additionally, it allows for more rapid provisioning of packages on the distribution point.

Location of the Content Library

A copy of the content library (containing all packages) is housed on the site server (as the source for distribution points).  Moreover, each distribution point will have a copy (as the source for clients), containing the packages distributed to the distribution point.  The content library is designed to optimize both network and disk usage in the distribution process.  This helps to keep our customers’ costs lower and efficiency higher.
The content library is typically stored on the root of a drive in a folder called “SCCMContentLib”.  This folder is shared and has restricted permissions to prevent accidental damage.  Within this are the Package Library (“PkgLib” folder), the Data Library (“DataLib” folder), and the File Library (“FileLib” folder).  The Package Library contains information about what packages are present on the distribution point.  The Data Library contains information about the original structure of the packages.  The File Library contains the original files in the package; this is typically where the bulk of the storage is used.
For instance, in the screenshot below, the content library is located on the root of the C: drive, in C:\SCCMContentLib.  It is shared as “SCCMContentLib$”.  Regardless of which drive the content library is located on, the primary share location will always be “SCCMContentLib$”.

Screenshot

 

Diagram

 

Package Library

The starting point for exploring the content library is the Package Library folder, “PkgLib”.  Within this folder will be several files, one for each package distributed to the distribution point.  The name will be the package ID, e.g. ABC00001.INI.  In this file is a list of contents IDs (under the “[Packages]” section) that are part of the package, as well as other information, such as the version.  Using these content IDs, we can continue exploring the contents of the content library.  Let us assume that ABC00001 is a legacy-style package, at version 1.  Thus, the content ID in this file will be ABC00001.1.

Data Library

Once we have found the content IDs we are interested in, we can continue exploring the content library.  In the Data Library folder, “DataLib”, there will be one file and one folder for each of the contents in each package.  This file and folder will be named, for example, ABC00001.1.INI and ABC00001.1, respectively.  The file contains information for validation.  Inside the folder, the folder structure from the original package is recreated. 
However, the files in the Data Library are replaced by INI files that have the name of the original file in the package, e.g. MyFile.exe.INI.  These files contain information about the original file, such as the size, time modified, and the hash.  The first four characters of the hash will help us find where the original file is in the File Library.  Suppose the hash in MyFile.exe.INI is “DEF98765”.  Thus, the first four characters are “DEF9”.

File Library

The last step in exploration is locating the file in the File Library, “FileLib”.  If the content library is spanned across multiple drives, the files could be in the File Library on any of these drives.
Using the first four characters from the hash found in the Data Library, we can locate the file.  Inside the File Library folder(s) will be many folders, each with a four-character name.  Find the folder that matches the first four characters from the hash.  Remember that the folder may be in the File Library on a different drive.
Once this folder is found, it will contain one or more sets of three files.  These three will share the same name, but one will have the extension INI, one will have the extension SIG, and one will not have any extension.  The file with no extension whose name is equal to the hash found above is the original file.
Using the example above, we would look for folder “DEF9”, containing “DEF98765.INI”, “DEF98765.SIG”, and “DEF98765”.  Here, “DEF98765” is MyFile.exe.  Additionally, in the INI file, there will be a list of “users”; these are content IDs that share the file.  The file will never be removed unless all of these contents are also removed.

Difference Between Distribute, Update, and Redistribute Actions

The first major action pertaining to content distribution is the Distribute action.  This refers to the initial distribution of a package to a distribution point.  This is triggered with Distribute Content in the Configuration Manager console.  This will transfer all files in a package to the target distribution points, excluding those which are already present as part of another package—these will become shared.
The second major action is the Update action.  This is typically used when a package has been changed and all distribution points to which it is distributed need the updated content.  This is triggered with Update Distribution Points in the console.  This will transfer the changed files to all distribution points.  Unchanged files will not be transferred.  If a file is removed from the package in the updated version, it will be deleted from the package on the distribution point (as long as no other packages are sharing it).
The third major action is the Redistribute action, triggered with Redistribute in the Configuration Manager console.  This will transfer the entire content to a specific distribution point.  Files will still be transferred and overwritten even if they are already present on the distribution point.  The chief purpose of the Redistribute action is to correct any inconsistencies that may exist in the content library.

Content Library Explorer

There is a new tool available in the System Center 2012 R2 Configuration Manager toolkit called “Content Library Explorer”.  This tool facilitates user-friendly exploration of the contents of the content library.  This tool cannot be used to modify the contents, but can provide insight into what is present, as well as allowing validation and redistribution.  Please refer to the toolkit documentation for more information. This documentation is installed with the toolkit.  There is typically a shortcut for it in the start menu called "System Center 2012 R2 Configuration Manager Toolkit Help".

Drive Spanning

The content library can be spanned across multiple drives.  These drives can be manually chosen by the administrator at the time the distribution point is created.  Alternatively, they can be chosen automatically by Configuration Manager (this is the default setting).
If they are chosen by the administrator, a primary and secondary drive can be chosen.  On the primary drive, all metadata will be stored.  Only the File Library will be spanned across to the secondary drive.  On secondary drives, the folder’s share name includes the drive letter.  For instance, if D: and E: are secondary drives for the content library, the share names would be “SCCMContentLibD$” and “SCCMContentLibE$”, respectively.
If “Automatic” is chosen, Configuration Manager selects the drive with the most available free space as its primary drive.  All of the metadata will be stored on this drive.  Only the File Library will be spanned across to secondary drives.  The administrator selects a reserve space amount; Configuration Manager attempts to use a secondary disk once the best available disk has only this reserve space amount left free.  Each time a new drive is selected for use, the drive with the most available free space is selected.
Currently it is not possible to specify that a distribution point should use all drives except for a specific set from the console.  It can be prevented by creating an empty file on the root of the drive, called exactly “NO_SMS_ON_DRIVE.SMS”.  This file must be present before the drive is selected for use by Configuration Manager.  If Configuration Manager detects this file on the root of the drive, it will not use the drive for the content library.  Additionally, there is a command-line tool in the toolkit for permanently moving the content library to a different drive, called “ContentLibraryTransfer.exe”.

Azure Distribution Points

Azure distribution points do not use single instancing.  This is because packages are encrypted before they are sent, and each package has a unique encrypted key.  So, even if two files were identical, the encrypted versions would not be.

Troubleshooting

Here are a few tips for troubleshooting issues with the content library:
  • Check the logs on both the site server (distmgr.log and PkgXferMgr.log) as well as on the distribution point (smsdpprov.log) for any pointers to the failures.
  • Use the Content Library Explorer tool to gain any additional insights.
  • Check if there are any file locks by other processes (e.g. antivirus) or other software.  It is a good practice to exempt the content library on all drives from automatic antivirus scans, as well as the temporary staging directory, “SMS_DP$”, on each drive.
  • If you still have issues you can try Validating the package from the Configuration Manager console and see if there are any hash mismatches.
  • As a last option, you can redistribute the content which should resolve the issue.

Orphaned Contents

On occasion, it is possible for, files, contents, or packages to be orphaned on a distribution point—they are not distributed to the distribution point, but due to an error during deletion, they were not deleted.  Often this is due to external programs (such as antivirus) having file locks on the content when deletion is attempted by Configuration Manager.
This is a known issue.  The operability of Configuration Manager is not affected; the distribution point will still function as intended.  However, this orphaned content can waste disk space.  We are investigating ways to clean up the existing orphaned content in future releases of the toolkit, as well as fixing the product to ensure that no future content is orphaned.

Disclaimer

It is not recommended to alter, add, or remove any files or folders in the content library.  Doing so could corrupt packages, contents, or the content library as a whole.  If missing, corrupt, or otherwise invalid data is suspected, the validation feature in the Configuration Manager console should be used to detect this, and the redistribution feature used to correct it.
 This posting is provided "AS IS" with no warranties and confers no rights.




Thursday, May 22, 2014

SCCM 2012 R2 UPGRADE



Upgrade for System Center 2012 Configuration Manager to Cumulative Update 1

Upgrading Central/Primary Server

  • Ensure all sites in the hierarchy run System Center 2012 Configuration Manager with R2.
  • Ensure the computing environment meets the supported configurations that are required for upgrading to System Center 2012 R2 Configuration Manager CU1.
  • Review the site and hierarchy status
  • Disable database replicas for management points at primary sites.
  • Back up the site database at the central administration site and primary sites.
  • Disable all site maintenance tasks at each site for the duration of that site’s upgrade.
  • Close an open Configuration Manager console before the upgrade. The installation process cannot upgrade an open console.
  • Run the Upgrade on the Primary Site to verify the prerequisite checks:
    • Verifying update applicability
    • Verifying Restart is not required
    • Verifying no active Configuration Manager Console is open
    • Verifying SQL connectivity

  • The update automatically upgrades the database
  • To manually update a site database, use SQL Server Management Studio to connect to the site's SQL Server, and then run the update script named update.sql on that site's database. When the update bundle installs, it extracts update.sql to the following location on the site server:

\\<Server Name>\SMS_<Site Code>\Hotfix\<KB Number>\update.sql.


Post Upgrade Activities

Automatic actions: Post upgrade the below actions are triggered automatically
  • To complete the Upgrade successfully the server needs to be rebooted.
  • The site performs a site reset, which includes a reinstallation of all site system roles.

Manual actions for the administrative user after an upgrade:


  • Distribute content for the new Configuration Manager client packages
  • Ensure that clients that are assigned to each primary site upgrade and install the client software for the new version.
  • Upgrade each Configuration Manager console that connects to the site and that runs on a computer that is remote from the site server.
  • At primary sites where the database replicas for management points runs, reconfigure the database replicas for System Center 2012 R2 Configuration Manager CU1. 


Upgrading Secondary Server

  • Ensure all Secondary Server are on SCCM 2012 R2
  • Review the site and hierarchy status and verify that there are no unresolved issues.
  • Disable all site maintenance tasks at each site for the duration of that site’s upgrade.
    • Backup Site Server
    • Delete Aged Client Operations
    • Delete Aged Discovery Data
  • It is advices to reboot every server post update installation.








Upgrading Client
  • Installation of the Update Bundle on the Primary creates packages for Client upgrade
  • The packages can be deployed to collection across environment.
  • The client updates can also be installed manually on individual clients



msiexec.exe /p \\<ServerName>\SMS_<SiteCode>\Hotfix\<KB Number>\Client\<Platform>\<msp> /L*v <logfile>REINSTALLMODE=mous REINSTALL=ALL



SCCM 2012 R2 Client Version 5.00.7958.1000





SCCM 2012 R2 CU1 Client Version 5.00.7958.1203


Cumulative Update 1 for SCCM 2012 R2

The redirecting page will be displayed and immediately replaced by “MzComputers.com”. With this zero-delay, many users will not even notice the presence of the redirecting page.

Download and extract the CU1 for SCCM 2012 R2 from below location:

Run CM12-R2CU1-KB2938441-X64-ENU.exe with administrative rights.
Follow the default installation as per the screenshots below.









Prerequisite Check:



SCCM 2012 R2 Console update:




Updating Site Database: 



Update package Creation for Site servers, Console and Clients
















Package for Site Servers:

These packages are created under Software Library>Application Management > Packages> Configuration Manager Updates


















Package for SCCM 2012 R2 Console update:

















Package for SCCM 2012 R2 Client:




Setup Summary


















Install Process:

Installation logs can be found at: C:\Windows\temp\CM12-R2CU1-KB2938441-X64-ENU.log
























Successful Completion of installation:















  • The CU1 requires a mandatory reboot.
  • The reboot is not a force reboot.



Below are the packages added automatically after the CU1 upgrade.
These packages can be used to deploy to all servers and clients


Wednesday, May 21, 2014

Mz Computers - SCCM 2012 Application Export issue.

The redirecting page will be displayed and immediately replaced by “MzComputers.com”. With this zero-delay, many users will not even notice the presence of the redirecting page.


Application export feature in SCCM 2012 may generate the below

Error: The specified path, file name, or both are too long. The full qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.


The root cause is limitations in the Windows file I/O APIs.
It ideally depends on the longest path in the Application source.
To get the longest path of the source we need to mounted or we can navigate to the source folder in PowerShell, and run below command

$len=0;dir -r|%{if ($_.FullName.Length -gt $len) {$len=$_.FullName.Length}};$len

For ex: Longest path: 100
Which leaves 155 char for SCCM 2012, as it add few files.

Exporting an Application with source creates 2 folders

  1. Application Source i.e. ApplicationName\Content_GUID(36 char)
  2. Application Information for SCCM i.e. Package Metadata, Package Scope, additional .XML files

The total path size should be lesser than 255.


PowerShell to export Application in SCCM 2012


Export-CMApplication -Path c:\AppName.zip –Name (LocalizedDisplayName) -IgnoreRelated -OmitContent

Mz Computers - Site Replication Model

The redirecting page will be displayed and immediately replaced by “MzComputers.com”. With this zero-delay, many users will not even notice the presence of the redirecting page.


SCCM ConfigMgr 2012 Site to Site replication & SQL Replication Guide



Key Components - Site Replication Model


New (SQL) site to site replication model is the most challenging part of System Center 2012 Configuration Manager. Main pillars of SQL replication model.
Key components of new (SQL) replication model
·         DRS – Data Replication Service
·         SSB – SQL Service Broker
·         RCM – Replication Configuration Management/Monitoring
·         RG – Replication Group
·         Replication Pattern
·         Article Name/s


Pillars of SQL replication model

u DRS – Data Replication Service / SSB – SQL Service Broker
u  To replicate the data between configmgr sites, Configuration Manager uses Database Replication Service (DRS). The DRS intern uses SQL Server Service Broker (SSB) to replicate data between the sites.
u RCM -  Replication Configuration Management/Monitoring
u  RCM is a thread of SMSEXEC. This thread keeps an eye on Replication Configuration and Monitoring.
u RG – Replication Group
u  Replication Groups are a set of tables that are monitored and replicated together. Replication groups are segregated and grouped in to THREE Replication Patterns.
u  To get the full list of RG along with replication schedule – Run the SQL query – Select * from vReplicationData each RG (Replication Group) has a unique Replication ID.







u Replication Pattern
u  Replication Patterns are group rules based on those, the replication groups are segregated. Three replication patterns are available.
 





u  a) Global – Global data is anything that is created by administrator. Two way replication between the CAS and Primaries. e.g Package Metadata









u  b) Global_Proxy – This Replication data is based out secondary servers.






u  c) Site – One way replication to the parent site / CAS. e.g Software Inventory/Hardware Inventory


u Article Name/s
u  Replication Groups are further divided into Article Names based on ReplicationID . Each RG (Replication Group) has a unique Replication ID.
u   Run the SQL query to get the list of Article Names “ Select * from vArticleData “ e.g  Add_Remove_Programs_64_DATA, Add_Remove_Programs_64_HIST, Add_Remove_Programs_DATA, BoundaryGroup, BoundaryGroupMembers etc








Force Site to Site Replication / re-init process

u  EXEC spDrsSendSubscriptionInvalid
u  e.g  EXEC spDrsSendSubscriptionInvalid ‘PrimarySitecode′, ‘CentralSitecode’, ‘Configuration Data’









  
u  Verifying site replication through SQL Server Management Studio
u  SELECT TOP 1000 *, casted_message_body = CASE message_type_name WHEN ‘X’ THEN CAST(message_body AS NVARCHAR(MAX)) ELSE message_body END FROM [CM_CAS].[sys].[transmission_queue] where to_service_name = ‘ConfigMgrDRS_SitePR1′