-
Installation Guide
-
Admin Guides
-
User Guides
-
References
Windows Inventory Collection Script
Many customers have requested the ability to report on things that are either not collected or not accurately collected by Intune. In an effort to fill these gaps in we have implemented a custom solution to collect some of the most commonly requested items. Currently this list includes:
- Software installed on Windows 10 devices.
- Software installation date.
- Monitors (LCD’s) connected to Windows 10 devices.
- Disk health.
- Last Reboot time.
- Additional CPU details.
- OS Install date.
- Additional RAM details.
- Battery health.
- Friendly model names for Lenovo computers.
- Warranty information for Dell, Lenovo, HP, and Getac computers.
- M365 update installation and compliance details.
- Windows driver inventory.
This data is collected via PowerShell, sent to a Log Analytics workspace, and then pulled into Power BI. Most customers leverage a Proactive Remediation detection to run the PowerShell script on a defined schedule. In this document we describe how to configure the script and deploy it using a Proactive Remediation however there are many ways that you might run a script on a schedule.
Prerequisites:
- Appropriate licenses to use remediation scripts in Intune.
- Dell requires an API token, which you can request by applying at https://techdirect.dell.com/Portal/APIs.aspx.
Lenovo requires a client token. Unlike Dell, this process is less straightforward—you’ll need to contact your Lenovo account representative to request the token on your behalf.
HP requires both an API key and a secret. Note that the secret expires frequently. During our testing, the HP API was often unreliable; however, their support team was responsive, and it’s encouraging to see HP making the API available to customers again. You can initiate access by contacting your HP representative or by signing up at https://developers.hp.com/.
You can copy the PowerShell script from our GitHub repository.
Step 1
- Paste the PowerShell code into your favorite script editor.
- On the line starting with $CustomerId = enter your Log Analytics Workspace ID between the quotes.
- On the line starting with $SharedKey = enter your Log Analytics Workspace Primary Key between the quotes.
- Save the script as a .ps1 file. For example CollectInventory.ps1.
Step 2
- If you plan to collect warranty data set $CollectWarranty = $true.
- Warranty data is cached locally on each device so that we do not make a call to the manufacturer API for each device each day. The cache is refreshed every 180 days by default. This is configurable using $WarrantyMaxCacheAgeDays. The cache can be force refreshed using $WarrantyForceRefresh.
Step 3
- If applicable enter the Dell Client ID and Client Secret values. When you retrieve this info from TechDirect it will be in a format similar to xxxxxxxxxx (yyyyyyyyy). The part before the opening parenthesis is the Client ID, the part inside the parenthesis is the Client Secret. (Note: Do not enter the parenthesis themselves in the script)
- If applicable enter the Lenovo Client ID provided to you by your Lenovo account rep.
- If applicable enter the HP Client ID and Client Secret provided to you by your HP account rep. (Note: HP expires their secrets very frequently so you will have to update these regularly.)
Step 7
Step 8
- Optionally add Scope tags.
- Select Next.
