Quick USB-based HWID grabber for Windows Autopilot enrollment — no internet, no PSGallery, no fuss. Just plug in the USB during OOBE and run.
Two scripts, one job:
Get-WindowsAutopilotInfo.ps1— Microsoft's standard script (v3.9) that pulls the hardware hash, serial number, and device details via CIM.RUN-HWID.ps1— thin wrapper that auto-detects the USB path and calls the above, outputtingAutopilotHWID.csvdirectly onto the stick with Group TagTEMpre-set.
The CSV lands right on the USB, ready to import into Intune > Devices > Enroll devices > Windows enrollment > Devices.
First, copy both RUN-HWID.ps1 and Get-WindowsAutopilotInfo.ps1 to the root of the USB stick (D:\).
Adjust the Group Tag TEM to your choice
Then during OOBE, drop into CMD (Shift+F10) and run:
powershell.exe -executionpolicy bypass -file D:\RUN-HWID.ps1Swap
D:\for whatever drive letter your USB got assigned. You can check this via disk volume
That's it. The script resolves its own path, so no hardcoded drive letters needed — just point at RUN-HWID.ps1 and go.
AutopilotHWID.csv written to the root of the USB, formatted for direct Intune import.
- Group Tag is hardcoded to
TEMinRUN-HWID.ps1— change the-GroupTagvalue there if needed. - No network required, no module installs, works fully offline in OOBE.
Get-WindowsAutopilotInfo.ps1is the stock Microsoft script — swap in a newer version anytime without touchingRUN-HWID.ps1.