You have Compliance Items all set up in an environment, all added into a nice baseline that is deployed out to your estate and all is good in the world. You decide that you want to export the baseline into CAB file for any number of reasons. You want to send it to a buddy at another company so he can benefit from your excellent work. Or maybe you are a consultant who wants to save the good work you have done so that you can make it a part of the value you provide to your customers going forward. We all love reusable work. But what happens when your reusable work ends up being something less than reusable?
Has anyone had difficulty importing a Compliance Baseline from a CAB file in ConfigMgr 2012? I just had that problem. It looked like this…

FailedCIImport

So I scratched my head. My first instinct was to do what we all do and consult with the All-Knowing Google on the matter. I searched "The CI contains a missing or invalid CI reference". Two hits. Don't you love it when you look up a problem and find two hits? Well, hopefully if you are having this issue, this shows up as a third hit and is more helpful that the two I found. The suggestions I saw were to remove the configuration from the baseline being imported and try again.
I figured there has to be an answer, and this is what I came up with to fix the issue I am having.
I examined the Files in the exported CAB file and compared them to the contents of other exported Configuration Baseline CAB files I have used successfully. I noticed a difference, edited the XML files in the CAB, rebuilt the CAB, and import was then successful. Now for a three item baseline it might not be a big deal, but if you have a baseline with several failing items this just might be better than rebuilding all of the Configuration Items. Or perhaps you don't know what was in the original Configuration Items and can't recreate them. Either way, you may have a good reason for wanting to fix what you have rather than doing it over.
I exported the contents of the CAB file into a temporary folder. The folder was named E:\Source\CabRebuild.
First, the difference I had noticed was with the Operating Systems defined in the Configuration Items. The XML files in the failing import contained an "Operands" section that was populated as shown here…

OSInformation-Before


I edited the "Operands" section in the XML files in E:\Source\CabRebuild as follows…

OSInformation-After


I did this for the XML that corresponded to each failing Configuration Item.
Now I had to put the files back in the CAB. Not as easy as a drag and drop, but not hard to do. The Microsoft Knowledgebase Article you can find at https://support.microsoft.com/kb/176810 explains how to manually rebuild a CAB file. It doesn't explain the format of the DDF file you need to use in the process though. Basically it goes like this.
Step 1 – Create the DDF file to configure the operation of MakeCab.exe. This is the definition of the structure of the CAB file.
DDF FIle:
.OPTION EXPLICIT ; Will Generate errors for mistakes
.set DiskDirectoryTemplate=CDROM ; All cabinets go into a folder
.Set CompressionType=MSZIP ;** All files are compressed to cabinet files
.Set UniqueFiles="OFF"
.Set Cabinet=on
; Destination Folder
.Set DiskDirectory1=E:\Source
; File name for the new cab file
.Set CabinetNameTemplate=PXEEverywhereBaseline.cab
; Files to be added are listed below
"E:\Source\CabRebuild\16805024_1E PXE Everywhere Service State.en-US.resx"
"E:\Source\CabRebuild\16805024_1E PXE Everywhere Service State.xml"
"E:\Source\CabRebuild\16805039_1E PXE Everywhere Service StartType.en-US.resx"
"E:\Source\CabRebuild\16805039_1E PXE Everywhere Service StartType.xml"
"E:\Source\CabRebuild\16805040_1E PXE Everywhere 2.1.0.33.en-US.resx"
"E:\Source\CabRebuild\16805040_1E PXE Everywhere 2.1.0.33.xml"
"E:\Source\CabRebuild\16805050_1E PXE Everywhere License.en-US.resx"
"E:\Source\CabRebuild\16805050_1E PXE Everywhere License.xml"
In order to easily get the list of files you can grab a bare format directory listing and either grab the file names from the command prompt window or pipe them into a text file. Remember, if there are spaces in the path/filename you must enclose them in double quotes.

ListFilesBareFormat


I put my DDF file in the E:\Source folder. Once the DDF file is complete you can make the CAB file. It's easy.
Step 2 – Use MakeCab.EXE (included in Windows 7, Server 2008). The syntax is makecab /F MyCABDefinition.DDF. The command I used is shown below…

MakeCab


Now that you have rebuilt the CAB you can import it into ConfigMgr.

SuccessfulCIImport


I hope that this information is helpful 🙂