The easiest way to create a new custom inventory script task is to clone the existing sample and customize it according to your needs. The sample script for Windows already contains the required code for a WMI query. You only need to add your own logic to gather the data that you want and to populate the attribute variables in the script.
Note that every time you create or edit an existing custom data class, the data class is assigned a new GUID. You must manually update the script with the new GUID, if it refers to the older GUID for the same custom data class.
To customize the custom inventory sample script for Windows