ConfigMgr 2012 Hardware Inventory Resync and BADMIF Internals


Hi Folks,

This post will help you understand the flow of Resync of Inventory in the ConfigMgr 2012. There are many scenarios when a resync can be generated;

1. If we miss a delta inventory.

2. If the get a badly formatted MIF. (E.g. There is a column mismatch or a datatype mismatch)

So below are the snippets that can help understand the issue and how to track it.

 

In the Dataldr.log –


Begin transaction: Machine=CM12-PR1-CL1(GUID:3495E328-878C-4230-8B53-80E200A9B0C4)     SMS_INVENTORY_DATA_LOADER                10/1/2014 6:38:24 AM      4420 (0x1144)

WARNING – Attempting to resync due to missed delta reports (sp return code = 7)              SMS_INVENTORY_DATA_LOADER                10/1/2014 6:38:25 AM      4420 (0x1144)

Rollback transaction: Machine=CM12-PR1-CL1(GUID:3495E328-878C-4230-8B53-80E200A9B0C4)                SMS_INVENTORY_DATA_LOADER     10/1/2014 6:38:25 AM      4420 (0x1144)

SQL MESSAGE: spAddInventoryLog – Inventory Log for machine:CM12-PR1-CL1,Server:4.9,Client:4.11,Message:Missing Delta. Resync,Detail:       SMS_INVENTORY_DATA_LOADER     10/1/2014 6:38:25 AM      4420 (0x1144)

Remote client hardware inventory resync generated for client GUID:3495E328-878C-4230-8B53-80E200A9B0C4; update/insert result = 2               SMS_INVENTORY_DATA_LOADER     10/1/2014 6:38:25 AM      4420 (0x1144)

Send resync command to local site for machine GUID:3495E328-878C-4230-8B53-80E200A9B0C4.                SMS_INVENTORY_DATA_LOADER     10/1/2014 6:38:25 AM      4420 (0x1144)

STATMSG: ID=2722 SEV=I LEV=M SOURCE="SMS Server" COMP="SMS_INVENTORY_DATA_LOADER" SYS=SQL2.*******.com SITE=PR1 PID=5936 TID=4420 GMTDATE=Wed Oct 01 01:08:25.604 2014 ISTR0="CM12-PR1-CL1" ISTR1="" ISTR2="" ISTR3="" ISTR4="" ISTR5="" ISTR6="" ISTR7="" ISTR8="" ISTR9="" NUMATTRS=0     SMS_INVENTORY_DATA_LOADER     10/1/2014 6:38:25 AM                4420 (0x1144)

Cannot process MIF XHAP1CV7H.MIF, moving it to C:\Program Files\Microsoft Configuration Manager\inboxes\auth\dataldr.box\BADMIFS\DeltaMismatch\utl30wij.MIF           SMS_INVENTORY_DATA_LOADER     10/1/2014 6:38:25 AM          4420 (0x1144)

STATMSG: ID=2703 SEV=W LEV=M SOURCE="SMS Server" COMP="SMS_INVENTORY_DATA_LOADER" SYS=SQL2.*******.com SITE=PR1 PID=5936 TID=4420 GMTDATE=Wed Oct 01 01:08:25.715 2014 ISTR0="XHAP1CV7H.MIF" ISTR1="C:\Program Files\Microsoft Configuration Manager\inboxes\auth\dataldr.box\BADMIFS\DeltaMismatch\utl30wij.MIF" ISTR2="" ISTR3="" ISTR4="" ISTR5="" ISTR6="" ISTR7="" ISTR8="" ISTR9="" NUMATTRS=0     SMS_INVENTORY_DATA_LOADER     10/1/2014 6:38:25 AM                4420 (0x1144)


 

We actually run sp_CheckHinvReportVersion for checking the version of the inventory which evaluates the below condition to return 7,

 

 
if ((@ReportVersion > (@LastReportVersion + 1)) AND 
(@ReportType = 0)) /* @ReportType(0)=DELTA, missed 1 or more deltas, resync 
*/
 
BEGIN
select 7 
/*SHDU_COMMAND_MISSED_DELTA_RESYNC*/

 

Then it logs (Sample) –

 

 
exec dbo.spAddInventoryLog 
N'GUID:3495E328-878C-4230-8B53-80E200A9B0C4',17179869195,'LogInventoryStatus',N'Missing 
Delta. Resync',N''

 

And then a resync is requested by calling–

 

exec sp_RC_InvResync N'GUID:3495E328-878C-4230-8B53-80E200A9B0C4', 1 

 

The second parameter to the above procedure is the type of resync. Below are the types –

 

iResyncInvFlag             Type of inventory resync.
1 hardware inventory resync
2 software inventory resync
10 file collection
20 state system resync

If you check this procedure, we simply create policy for the resync –


 
SELECT @padbid=PADBID FROM ResyncPolicy WHERE 
InventoryFlag=@invflag AND ActiveFlag = 1 
select @DeviceId = CONVERT(uniqueidentifier, CASE 
LEN(@smsid) WHEN 36 then @smsid 
else SUBSTRING(
IF @padbid IS NOT NULL 
@smsid, 6, LEN(@smsid)-5) end)
IF @padbid IS NOT NULL 
BEGIN 
IF EXISTS(select * from ResPolicyMap WHERE 
MachineID=@machineid AND PADBID=@padbid AND IsTombstoned = 0) 
SET @retval = 1 
ELSE 
BEGIN 
SET @tempdate = GetUTCDate() 
DELETE FROM ResPolicyMap WHERE MachineID=@machineid 
AND PADBID=@padbid 
INSERT INTO ResPolicyMap (MachineID, PADBID, 
LastUpdateTime, IsTombstoned) 
VALUES(@machineid, @padbid, @tem
INSERT INTO ResPolicyMap (MachineID, PADBID, 
pdate, 0)

ResyncPolicy is the table which gets updated and we modify the ResPolicyMap to the current time.

So a manual query to check the policyassignmentid –

 
SELECT * FROM ResyncPolicy where ActiveFlag = 1 and 
InventoryFlag = 1 

clip_image002

Once targeted to the client, the client then gets the same in the next policy cycle –


Validating PolicyAssignment '{1e51f138-7dbe-4137-9a8c-7e389c905a29}'.          PolicyAgent_ReplyAssignments        10/1/2014 6:53:45 AM          42344 (0xA568)

PolicyAssignment:<PolicyAssignment PolicyAssignmentID="{1e51f138-7dbe-4137-9a8c-7e389c905a29}">

                <Policy PolicyID="{1e658dd1-805a-4228-a36c-fc62f3565a50}" PolicyVersion="1.00" PolicyType="Machine" PolicyPriority="25">

<PolicyLocation PolicyHash="SHA256:AAAEEC34FB5EA404723D86529BC6C82705CE772898D24E9479EE3464BD5BA6E1" PolicyHashEx="SHA1:E21B61393EE818F13E08F2834347F636A9D441B9"><![CDATA[http://<mp>/SMS_MP/.sms_pol?{1e658dd1-805a-4228-a36c-fc62f3565a50}.1_00]]></PolicyLocation></Policy></PolicyAssignment>                PolicyAgent_ReplyAssignments                10/1/2014 6:53:45 AM      42344 (0xA568)


And then sends the Resync inventory –


CInvState::ReadInventoryActionPolicy            InventoryAgent    10/1/2014 6:55:03 AM      51356 (0xC89C)

Inventory: Action=Hardware, ReportType=ReSync, MajorVersion=5, MinorVersion=0        InventoryAgent    10/1/2014 6:55:03 AM                51356 (0xC89C)


Also adding the details of reasons when an Inventory is treated as BADMIF.

The Dataldr.log gives information when it rejects a MIF.

A few rejection errors by only version itself (before reading the MIF) are checked by [sp_CheckHinvReportVersion]

Outdated – The Client send a delta version which was less than what was expected by Dataldr. This causes a resync and it’s then fixed automatically.

 
if (@ReportVersion < @LastReportVersion) /* obsolete */
BEGIN
if (@ServerMajor = @ClientMajor)
BEGIN
select 8 /*SHDU_COMMAND_OBSOLETE_DELTA*/
END

DeltaMisMatch – The Client send a delta version which was more than what was expected by Dataldr. This causes a resync and it’s then fixed automatically.

 
BEGIN
if ((@ReportVersion > (@LastReportVersion + 1)) AND (@ReportType = 0)) /* 
@ReportType(0)=DELTA, missed 1 or more deltas, resync */
BEGIN
select 7 /*SHDU_COMMAND_MISSED_DELTA_RESYNC*/
return
END

MajorMisMatch – When there is a Major version mismatch.

 
else
BEGIN
select 9 /*SHDU_COMMAND_MISSED_MAJOR*/ --when major is different, 
client won't recover unless resync. bug 325705 
END

To find the Major and Minor versions from the DB –

//

 
select @LastReportVersion = cast(LastReportVersion as bigint),
 
@ServerMajor = convert(int, (cast(LastReportVersion as 
bigint)/4294967296)), -- Major version stored in db 
 
@ClientMajor = convert(int, @ReportVersion/4294967296), -- Major 
version from client report 
@ClientMinor 
= @ReportVersion % 4294967296 -- Minor version from client report 
from WorkstationStatus_DATA where MachineID = @MachineId

//

InvalidMachine – Reads the MIF and if cannot find the machine in the DB this will be marked as Invalid. ValidateMachine, FindMachine() are called to check that.

NonExistentRow – Generally for the resync which came tries to insert the record which is not in the DB. The logs gives the error with the Stored Procedure and the data which it was trying to update.

GroupFailure – When we are trying to process a MIF and if it fails to add the group for a class then we can get this error. We generally add the group in the GroupMap table which contains the groupname, the respective table name and their history table name along with Architecture. More info on the error in the logs.

MissingSystemClass – Failed because there was a Class in the MIF which had to reference in the GroupMap i.e. Error is Top Level group not found; expected group with the same name as the architecture.

InvalidFileName – If the MIF file name is more than 14 characters and the first three letters are (XXX or xxx) then the file is considered as Invalid.

ExceedSizeLimit – If the MIF file exceeds the size limit (HKLM\Software\Microsoft\SMS\Components\SMS_Inventory_Dataloader\Max MIF Size) then it will be placed here.

ErrorCode_%d – If the MIF file failure is because of any other reasons other than above then it will be placed here. Here %d is the ErrorCode for the failure. Log file can help in identifying the cause.

Umair Khan

Support Escalation Engineer | Microsoft System Center Configuration Manager 

Disclaimer: This posting is provided "AS IS" with no warranties and confers no rights.

Comments (7)

  1. Great article. Thank you.

  2. Abbia says:

    Very useful info !!

  3. Anonymous says:

    This week I worked with a customer who asked me several in-depth questions related to Hardware Inventory

  4. Anonymous says:

    Yesterday, a customer asked me to look for trends within his BADMIFs folder and tell him if there were

  5. will says:

    Umair – what is the timing between when a client gets the policy and when it will do its next (full) hardware inventory? Is it immediate, the next time machine policy runs, or the next scheduled time HW inventory will run? So if HW inventory only runs
    every 5 days, will it be another 5 days before the full inventory is run and sent in?

  6. kljwilliams says:

    Can these files be deleted and they will resync on its own?

Skip to main content