In this post, we will explore how to obtain the hardware specifications of Intune devices using a Remediations script.
Table of Contents
Device Hardware Specs
In the context of this post, we will define ‘Hardware Specs’ as specific attributes of an endpoint, such as memory and CPU information. While Intune provides information about various specifications, such as memory size, it does not provide insight into CPU or HDD/SSD types, among other details.
As shown in the screenshot above, we can access device Memory and Storage information directly from the Portal, but there is no information available about the CPU.
Get Device Hardware Info using PowerShell
To obtain additional information about a device not provided out of the box, we can use Remediations scripts. Below is an example script that retrieves CPU, Memory, and Storage information:
$valueToReport = ""
$processorSpecs = gcim win32_processor
$processorName = $processorSpecs.Name
$valueToReport += ("Processor Name: " + $processorName.Trim() + "||")
$processorSpeed = [string]([math]::round(($processorSpecs.CurrentClockSpeed /1000),2)) + 'ghz'
$valueToReport += ("Processor Speed: " + $processorSpeed.Trim() + "||")
$processorCores = $processorSpecs.NumberOfCores
$valueToReport += ("Processor Cores: " + $processorCores.ToString() + "||")
$processorThreads = $processorSpecs.ThreadCount
$valueToReport += ("Processor Threads: " + $processorThreads.ToString() + "||")
$storage = ""
$hdd = gcim Win32_DiskDrive | where {$_.MediaType -like "Fixed*"}
$hdd | ForEach{$storage += $_.caption + ", Capacity: " + [math]::round(($_.Size / 1GB),'2') + "GB - " }
$valueToReport += ("Storages: " + $storage.Trim() + "||")
$ramTotal = "{0:N2}" -f (((gcim CIM_PhysicalMemory | select -ExpandProperty Capacity) | measure -Sum).sum /1gb ) + ' GB'
$valueToReport += ("RAM Size: " + $ramTotal.Trim() + "||")
$computerName = $env:ComputerName
$valueToReport += ("Computer Name: " + $computerName.Trim() + "||")
$systemType = gcim win32_operatingsystem | select -ExpandProperty OSArchitecture
$valueToReport += ("System Type: " + $systemType.Trim() + "||")
$serial = gcim win32_bios | select -expandproperty serialnumber
$valueToReport += ("Serial Number: " + $serial.Trim() + "||")
$os = gcim win32_operatingsystem | select -expandproperty caption
$valueToReport += ("OS: " + $os.Trim() + "||")
Write-Host $valueToReport
Remediation Script for Hardware Info Collection
Now that we have the script ready, let’s deploy it to some devices via Remediations.
First we create a new script package.
Then give a name and a description to the remediation script.
At the next step upload the previously developed script.
Since we just want to get information from the device, no Remediation script is required but only a Detection one.
Assign the script to the desired device group and define the schedule.
Review the configurations and create the package.
After deploying it to the endpoints, we have to wait for the script to run and then check the returned results.
An indicative result is shown below:
Processor Name: AMD Ryzen 5 3600 6-Core Processor||Processor Speed: 3.6ghz||Processor Cores: 6||Processor Threads: 12||Storage: INTENSO, Capacity: 476.94GB – KINGSTON, Capacity: 447.13GB – WDC, Capacity: 931.51GB -||RAM Size: 32.00 GB||Computer Name: Name||System Type: 64-bit||Serial Number: To be filled by O.E.M.||OS: Microsoft Windows 11 Education||
References and documentation:
Check the below posts to find out more interesting relevant topics: