Having model and manufacturer collections can be quite useful. Targeting client settings based on manufacturer, deploying BIOS / drivers based on model, and having collections makes it a bit easier. In the previous posts, we talked about adding additional information into hardware inventory, well this script relies on those things being done.
What is this script, what does it do, and why might I want it?
This script looks through your ConfigMgr site inventory, provides a list of manufacturers and models for you to choose from, and once you’ve picked, it creates collections with queries to populate them.
- Additional Items in Hardware Inventory for HP & Lenovo
- HP requires Baseboard Product
- Lenovo requires ComputerSystemProduct Version & Name
- CM PowerShell Module (Typically a Machine with the CM Console Installed)
- User rights in CM to create collections and read inventory
The script should work out-of-box, but you can customize it to fit your needs. You can change the PreFix on the Collection Names, which types of collections you want made, and if you dig into the code a bit more, you can change the comments on the collections as well. Creating this script helped me learn a lot about collection queries and setting up collections with PowerShell.
If you want to change the refresh times on the collections, look for the $Schedule and change that to fit your needs.
Once you’ve picked the models you want collections for, the script takes over and creates them.
If you pick a model or manufacturer to create a collection for, and there is already a collection by the same name, it will skip creation and let you know.
After the script completes, you can see the results in your console.
The script is very dynamic. Feel free to bend it to your needs. You can look forward to Recast’s Right Click Tools including more hardware related information in the Device Dashboard in upcoming releases.
Script available on GitHub