Home About Tools Projects Guides & Blog ⚡ Hire Me ✦ Websites Contact →
💻 Intune

How to Capture Windows Autopilot Hardware Hashes (4 Methods)

If you've got a stack of new laptops that need enrolling in Intune but aren't showing up in Autopilot yet, this guide covers the fastest ways to grab the hardware hash without sitting through the full Windows setup.

You can pull the hardware hash straight from the welcome screen without going through the full OOBE.

What is a Hardware Hash?

A hardware hash is a unique fingerprint for a specific device. It's generated from the device's hardware components, including the motherboard, CPU and TPM chip.

When you upload this hash to your Intune tenant, you're telling the cloud: "If this specific piece of hardware ever hits the internet, send it straight to our company login screen, not the default Windows consumer setup."

Because it is tied to the physical hardware, it's persistent. You can wipe the hard drive, reinstall Windows, and the moment that laptop sees a Wi-Fi signal it'll still know it belongs to your company.

Hash vs. Serial Number: Why the extra steps?

Serial numbers aren't as unique as we'd like to think, across different manufacturers and years of production, duplicates can happen. The Hardware Hash is a large encrypted string that is mathematically unique to that specific machine build.

By using the hash, Microsoft performs a high-level security handshake that prevents device spoofing, ensuring someone can't guess your serial numbers and hijack your Autopilot setup.

Prerequisites

  • Internet Access, For the Direct Upload method, connect via Ethernet or Wi-Fi at the welcome screen.
  • Admin Rights, You'll need an account with Global Administrator or Intune Administrator.
  • Power, Keep the laptop plugged in. A TPM handshake failing due to low battery is an avoidable headache.

Method 1, The USB Stick Routine

The classic approach for processing a batch of laptops and uploading them all at once later.

Step 1: Grab the Hash

  1. 1Power on the laptop. At the Welcome or Region screen, don't click anything. Press Shift + F10 to open a command prompt.
  2. 2Type powershell and hit Enter.
  3. 3Run the following commands:
PowerShell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

Type 'Y' if asked.

PowerShell
Install-Script -Name Get-WindowsAutoPilotInfo

Type 'Y' for NuGet.

PowerShell
Get-WindowsAutoPilotInfo.ps1 -OutputFile C:\HWHash.csv

Step 2: Move the Hash to Your USB

Plug in your USB drive. You need to find the drive letter so you can copy the file to it.

  1. 1Open DiskPart:
Command Prompt
diskpart
  1. 2List volumes to find your USB drive letter:
DiskPart
list volume
  1. 3Find your USB in the list and note the letter (in this example it's D). Then type exit.
  2. 4Copy the file to the USB:
Command Prompt
copy C:\HWHash.csv D:\

If you get a "file not found" error, verify you saved it to the root of C: in the previous step. You can check by typing dir C:\HWHash.csv

Tip, Batch Devices
Doing a bunch of devices? Save yourself time and run the below instead to save directly to your USB and append the data so it doesn't overwrite previous hardware hashes:
PowerShell
Get-WindowsAutoPilotInfo.ps1 -OutputFile D:\HWHash.csv -Append

Method 2, Direct Upload (No USB Required)

If you have a solid Wi-Fi or Ethernet connection, you can register the device directly to your O365 tenancy, no USB needed.

  1. 1Press Shift + F10 and enter powershell.
  2. 2Run the following script:
PowerShell
# 1. Bypass the policy for this specific window
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force

# 2. Install/Update the script silently
Install-Script -Name Get-WindowsAutoPilotInfo -Force

# 3. Upload directly to your Microsoft tenant
Get-WindowsAutoPilotInfo.ps1 -Online
  1. 3A login window will appear. If it doesn't, press Alt + Tab.
  2. 4Sign in with a Global Administrator or Intune Administrator account. The script uses the Microsoft Graph API to register the device directly.

Uploading the .csv to Intune

Once you have the HWHash.csv file, import it to Intune:

  1. 1Go to Microsoft Intune → Devices → Enrollment → Windows Autopilot → Devices.
  2. 2Click Import and select your HWHash.csv.
  3. 3Wait at least 15 minutes for the device to sync. Once it appears in the list, you're good to go.

Method 3, Graph API Import Script

If you've already got a CSV of hardware hashes and want to automate the import rather than clicking through the Intune Admin Centre each time, you can push them directly via the Microsoft Graph API using PowerShell. This is the fastest option for bulk imports and works well in an MSP or multi-tenant environment.

Run this from a machine that already has internet access and the Microsoft Graph PowerShell SDK installed.

PowerShell
# Install the module if you haven't already
Install-Module -Name Microsoft.Graph -Scope CurrentUser -Force

# Connect with the required scope
Connect-MgGraph -Scopes "DeviceManagementServiceConfig.ReadWrite.All"

# Set the path to your CSV file
$csvPath = "C:\HWHash.csv"
$devices = Import-Csv -Path $csvPath

foreach ($device in $devices) {
    $body = @{
        "@odata.type"       = "#microsoft.graph.importedWindowsAutopilotDeviceIdentity"
        serialNumber        = $device."Device Serial Number"
        productKey          = $device."Windows Product ID"
        hardwareIdentifier  = $device."Hardware Hash"
        groupTag            = $device."Group Tag"
        assignedUserPrincipalName = $device."Assigned User"
    }

    New-MgDeviceManagementImportedWindowsAutopilotDeviceIdentity -BodyParameter $body
    Write-Host "Imported: $($device.'Device Serial Number')" -ForegroundColor Green
}

Write-Host "Import complete. Allow 15 minutes for devices to appear in Intune."
CSV format reminder
Your CSV must include at least these column headers exactly: Device Serial Number, Windows Product ID, Hardware Hash. Group Tag and Assigned User are optional but the column headers must still match if present.

Method 4, Capturing the Hash from Within Windows (USB)

If the device has already been through OOBE and is sitting at the Windows desktop — perhaps a returned machine, a rebuild, or a device you didn't catch at the welcome screen — you can still capture the hash without wiping it. Run the script from within Windows itself and save directly to a USB stick.

This requires the device to be signed into a local or domain account with admin rights. Internet access is not required for this method.

Step 1: Plug in your USB drive

Note the drive letter (e.g. D: or E:). Open PowerShell as Administrator.

Step 2: Run the script

PowerShell
# Install the script from PSGallery
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
Install-Script -Name Get-WindowsAutoPilotInfo -Force

# Save the hash directly to your USB (replace D:\ with your drive letter)
Get-WindowsAutoPilotInfo.ps1 -OutputFile D:\HWHash.csv

If you're processing multiple devices one after another and saving to the same USB, use the -Append flag so each device appends to the same file rather than overwriting it:

PowerShell
Get-WindowsAutoPilotInfo.ps1 -OutputFile D:\HWHash.csv -Append

Step 3: Upload the CSV

  1. 1Take the USB to a machine with access to the Intune Admin Centre.
  2. 2Go to Devices → Enrollment → Windows Autopilot → Devices → Import.
  3. 3Select your HWHash.csv and wait 15 minutes for devices to sync.
When to use this method
This is the go-to for existing devices already running Windows — retired hardware being brought back into service, refurbished stock, or machines that missed the OOBE capture window. No internet needed on the device itself.

Wait, Do You Actually Need to Do This Manually?

Before you slice open 50 laptop boxes and start typing, check with your hardware vendor (Dell, HP, Lenovo, etc.).

Most major manufacturers offer a Direct-to-Autopilot service. If you provide your Tenant ID and Domain Name at time of order, their factory team can inject the hardware hashes into your Intune portal before the hardware even leaves the warehouse.

⚠️
Heads Up
If your vendor offers this service, you can skip this entire guide. Just hand the sealed box to the user, the magic happens automatically the first time they power it on.

This manual method is only really needed when:

  • Testing: You need a couple of machines to verify your deployment profile is working.
  • Hand-me-downs: Repurposing older gear or refurbished laptops being brought back into the fold.
  • Emergency runs: A one-off laptop grabbed from a local shop because someone's machine died and you couldn't wait for a vendor shipment.

Troubleshooting

Deployment is stuck

Use the diagnostics script below. This gives you a colour-coded list of exactly which policy or app is failing.

PowerShell
Install-Script -Name Get-AutopilotDiagnostics
Get-AutopilotDiagnostics.ps1

Error 0x800705b4

Usually caused by a TPM issue due to an incorrect system clock. For example, if the laptop thinks it's 16:45 but it's actually 16:49. Run the below to fix:

Command Prompt
w32tm /resync /force

Error 0x80180014

If you're redeploying a laptop that was previously in Autopilot, you must delete the old device record from the Intune Autopilot list first. Intune won't re-enrol a device it thinks it already knows.

"Is it managed yet?"

Run the below to verify the device has pulled its Autopilot profile:

Command Prompt
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"

Alternatively, check for the Autopilot marker file:

Command Prompt
dir C:\Windows\ServiceProfiles\LocalService\AppData\Local\Microsoft\NGC
📌
Wrapping Up
Manually capturing the hash is one of those "annoying but necessary" tasks we all face at some point. Once you've done it a few times it'll be muscle memory, and hopefully this guide saved you a trip through the full Windows OOBE.
J
Jack Davies
IT Engineer · M365 & Intune Specialist

Jack is an IT Technical Engineer based in the UK, working day-to-day with Microsoft 365, Intune, and Entra ID across a range of businesses. He holds the MS-900 certification and is studying for a BSc in Cyber Security through the Open University. Outside of work he builds and documents home lab projects, writes guides on this site, and takes on M365 consulting work for small businesses.

About Jack → LinkedIn →
// monthly tips

Get M365 tips in your inbox

Practical Intune and Microsoft 365 tips, once a month. No spam, no fluff.