Last updated on July 23rd, 2022 at 12:26 pm
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. In this post, I’ll show you how to avoid receiving inventory re-sync requests for snapshot VMs.
To solve this issue each time a VM is restarted (rebooted) we force the CM12/CM07 client to:
- Perform a heartbeat discovery (data discovery cycle).
- Delete the last full hardware, thereby forcing the next hardware inventory cycles to perform a full inventory.
- Delete software inventory data, thereby forcing the next software inventory cycles to perform a full inventory.
- Perform a hardware inventory.
- 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.
Avoid Receiving Inventory Re-Sync Requests
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
If you have similar issues, my advice is to setup a scheduled task every time a PC re-starts (with a 5 minute delay).
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. If you have any questions about how to avoid receiving inventory re-sync requests for snapshot VMs, please contact me @GarthMJ.