If you’re an IT administrator or systems engineer managing Windows devices in an enterprise environment, Windows Autopilot is one of the most powerful tools for modern device deployment. It streamlines the setup process for new Windows devices, ensuring they are pre-configured, secure, and ready for use straight out of the box.
A key step in this process is gathering the hardware hash and device details required for Autopilot registration. This is where the PowerShell script Get-WindowsAutoPilotInfo.ps1 comes into play.
In this tutorial, I will cover everything you need to know about using the Get-WindowsAutoPilotInfo PowerShell script — from installation to exporting device information and uploading it to Microsoft Intune.
What Is Windows Autopilot?
Windows Autopilot is Microsoft’s cloud-based deployment technology that simplifies the provisioning and configuration of new Windows devices. Instead of manually imaging machines, IT admins can register devices in Microsoft Intune or Microsoft Endpoint Manager (MEM), allowing users to set up their PCs with minimal IT interaction.
To register a device with Autopilot, Microsoft requires a hardware hash — a unique identifier that represents the device’s hardware configuration. This hash, along with the device’s serial number, is collected and uploaded to Intune or the Microsoft Store for Business.
Check out Delete User Profiles Using PowerShell in Windows 11
What Is Get-WindowsAutoPilotInfo.ps1?
The Get-WindowsAutoPilotInfo.ps1 script is a PowerShell tool developed by Microsoft that retrieves the necessary hardware and device information for Autopilot registration.
It uses Windows Management Instrumentation (WMI) to collect details such as:
- Device Serial Number
- Hardware Hash
- Manufacturer
- Model
- Product ID (optional)
This script can automatically save the data into a CSV file that can be uploaded to Intune or directly imported via the Microsoft Graph API.
💡 Note: It’s normal for the CSV file not to include a Windows Product ID (PKID). Only the serial number and hardware hash are required for Autopilot registration.
Prerequisites
Before running the script, ensure you have:
- Windows 10 or Windows 11 device (version 1709 or later)
- PowerShell 5.1 or higher
- Administrative privileges
- Internet access (if uploading directly to Intune)
- Microsoft Graph permissions (for direct import)
If you’re running the script on a new device, make sure it’s booted into Windows and connected to the internet.
Step 1: Install the Get-WindowsAutoPilotInfo Script
The script is available on the PowerShell Gallery, which makes installation straightforward.
Open PowerShell as Administrator and run:
Install-Script -Name Get-WindowsAutoPilotInfoIf prompted to install the NuGet provider or trust the repository, type Y and press Enter.
Once installed, you can verify by running:
Get-Command Get-WindowsAutoPilotInfo.ps1This confirms that the script is available on your system.
Check out Set the Default Printer Using PowerShell in Windows
Step 2: Run the Script to Collect Device Information
To collect device information and export it to a CSV file, use:
Get-WindowsAutoPilotInfo.ps1 -OutputFile AutoPilotHWID.csvThis command will:
- Retrieve the hardware hash and device details.
- Save them to a CSV file named AutoPilotHWID.csv in the current directory.
You can then use this CSV file to manually upload devices to Windows Autopilot.
Step 3: Upload Devices to Windows Autopilot Manually
After generating the CSV file, you can register devices manually in Microsoft Intune.
- Sign in to the Microsoft Intune admin center:
https://intune.microsoft.com - Navigate to:
Devices → Windows → Windows enrollment → Devices (under Windows Autopilot Deployment Program) - Click Import.
- Upload your AutoPilotHWID.csv file.
- Wait for the import to complete (this can take several minutes).
Once imported, the device will appear in your Autopilot devices list and can be assigned to a deployment profile.
Step 4: Upload Devices Directly to Intune Using PowerShell
If you prefer automation, you can upload device information directly to Intune using Microsoft Graph.
Run the following command:
Get-WindowsAutoPilotInfo.ps1 -OnlineYou’ll be prompted to sign in with an account that has Intune Administrator or Global Administrator permissions.
Once authenticated, the script will automatically:
- Collect the hardware hash.
- Upload it to the organization’s Autopilot service.
- Sync the device in Intune.
This is ideal for bulk deployments or when imaging multiple devices at once.
Check out Set the Time Zone Using PowerShell in Windows
Step 5: Verify the Device in Intune
After the upload, verify that your device appears in Intune:
- Go to Devices → Windows → Windows enrollment → Devices.
- Search for the device’s serial number.
- Confirm that it shows as Imported or Assigned.
You can now assign an Autopilot deployment profile to the device, ensuring it automatically configures itself on the next OOBE (Out-Of-Box Experience) boot.
Advanced Options or Parameters
The Get-WindowsAutoPilotInfo.ps1 script includes several useful parameters:
| Parameter | Description |
|---|---|
-OutputFile | Specifies the output CSV file path. |
-Online | Uploads device info directly to Intune. |
-Partner | For CSPs registering devices on behalf of customers. |
-TenantId | Specifies the Azure AD tenant for upload. |
-GroupTag | Adds a group tag for automatic profile assignment. |
Example for CSP or multi-tenant environments:
Get-WindowsAutoPilotInfo.ps1 -Online -TenantId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -GroupTag "FinanceDept"Check out Update PowerShell on Windows 11
Troubleshooting Common Issues
Here are some common issues you may face, along with the solutions you can follow to resolve them.
- Script Not Found: If PowerShell cannot find the script, reinstall it:
Install-Script -Name Get-WindowsAutoPilotInfo -Force- Permission Errors: Ensure your account has Intune Device Administrator or Global Administrator rights.
- Hardware Hash Missing: If the CSV file is empty or missing data, confirm you’re running PowerShell as Administrator and that the device is not running in Safe Mode.
- Graph API Authentication Failure: If authentication fails, re-run the script and accept the Microsoft Graph permissions for your organization
Conclusion
The Get-WindowsAutoPilotInfo PowerShell script is used to manage Windows devices in modern, cloud-first environments. It streamlines the process of collecting and registering devices with Windows Autopilot, saving time and reducing manual errors.
Do let me know if you still have any issues.
You may also like the following tutorials:
Bijay Kumar is an esteemed author and the mind behind PowerShellFAQs.com, where he shares his extensive knowledge and expertise in PowerShell, with a particular focus on SharePoint projects. Recognized for his contributions to the tech community, Bijay has been honored with the prestigious Microsoft MVP award. With over 15 years of experience in the software industry, he has a rich professional background, having worked with industry giants such as HP and TCS. His insights and guidance have made him a respected figure in the world of software development and administration. Read more.