< Blog

How to Avoid Receiving Inventory Re-Sync Requests for Snapshot VMs

By Garth Jones

In Wednesday’s and Thursday’s blog posts I showed you easy ways to force a full hardware inventory on a PC or multiple PCs.

We use Hyper-v to make snapshots of the VMs in our test lab. This is done so that we can quickly revert a VM to a known state. In this case, the SCCM Client Center tool and the previously mentioned right-click tools don’t work as effectively, so manual intervention is required in order to force a full hardware inventory.

To solve this issue each time a VM is restarted (rebooted) we force the CM12/CM07 client to:

1. Perform a heartbeat discovery (data discovery cycle).

2. Delete the last full hardware, thereby forcing the next hardware inventory cycles to perform a full inventory.

3. Delete software inventory data, thereby forcing the next software inventory cycles to perform a full inventory.

4. Perform a hardware inventory.

5. Perform a software inventory.

Since I don’t want to perform this task manually each time, I scripted all of the actions listed above by using WMIC. Then I set a scheduled task to run every time a VM re-starts with a 5 minute delay. The 5 minute delay allows the Configuration Manager client to start before you try to force the inventory action to occur.

Using WMIC you can trigger each action to occur sequentially. Below is the list of commands that we use.

Heartbeat / Data Discovery Record:
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule “{00000000-0000-0000-0000-000000000003}” /NOINTERACTIVE

Delete Hardware Inventory Data:
WMIC /namespace:\\root\ccm\invagt path inventoryActionStatus where InventoryActionID=”{00000000-0000-0000-0000-000000000001}” DELETE /NOINTERACTIVE

Delete Software Inventory Data:
WMIC /namespace:\\root\ccm\invagt path inventoryActionStatus where InventoryActionID=”{00000000-0000-0000-0000-000000000002}” DELETE /NOINTERACTIVE

Perform Hardware Inventory:
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule “{00000000-0000-0000-0000-000000000001}” /NOINTERACTIVE

Perform Software Inventory:
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule “{00000000-0000-0000-0000-000000000002}” /NOINTERACTIVE

Inventory ReSync-Task Scheduler

If you have similar issues, my advice is to setup a scheduled task every time a PC re-starts (with a 5 minute delay).

Inventory ReSync-Actions

Simply by setting-up a scheduled task to perform all 5 actions sequentially, we avoid having to perform them manually and avoid having outdated data within our CM12 environment. This is also useful for PCs that have deep freeze or other similar technology where a PC’s inventory may get out of sync easily.