Extract HWID from Intune

Facing a tenant to tenant migration of including devices enrolled in Intune utilizing Windows Autopilot and want to extract the HWID of each machine?

There is no built-in feature for doing this, a export from Intune Windows Autopilot devices will only generate rudimental information about the device such as Manufacturer, Model, Group tag and so on.

This is not what we need, where are the HWIDs for the machines?

As the devices are enrolled in the old tenant we can still run scrips on the machines, lets utilize this to deploy a small PowerShell script that extracts the HWID from each machine and uploads it to a Azure Blob storage.

The Script:

#=========================
#Sets Hash Directory and Generates Hardware Hash file
#=========================
$CSVPath = new-item -Path "c:\" -Name "HWID" -ItemType Directory -Force
$serialnumber = Get-WmiObject win32_bios | select Serialnumber
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Script -Name Get-WindowsAutoPilotInfo -Force
Set-ExecutionPolicy Unrestricted -Force
Get-WindowsAutoPilotInfo -Outputfile $CSVPath\$($serialnumber.SerialNumber)-hwid.csv
#===========================
#Download and Extract AZCopy
#===========================
$downloadsource = 'https://aka.ms/downloadazcopy-v10-windows'
$filename = "azcopy.zip"
Start-BitsTransfer -Source $downloadsource -Destination $CSVPath\$filename | Out-Null
Expand-Archive -LiteralPath $CSVPath\azcopy.zip -DestinationPath $CSVPath -Force
Move-Item -Path $CSVPath\azcopy_windows_amd64_10.18.0\azcopy.exe -Destination $CSVPath
CD $CSVPath
#=========================
#Upload to Blob
#=========================
#Hash File:
$file = "$CSVPath\$($serialnumber.SerialNumber)-hwid.csv"
#Storage Account SAS URL
$sasurl = "*your blob url and SAS key (read & write permissions)"
#Copy File
.\azcopy.exe copy $file $sasurl | Out-Null

Deploy it in Intune as system and let the machines do the magic of automatically uploading the HWID to a central location and you can import them to the new tenant.



Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.