AutopilotIntune

Tutorial: Auto Upload Windows Autopilot hardware hash

Getting the hardware hash for a new laptop or desktop typically involves several steps. You’d need to open PowerShell, set the execution policy, install the get-windowsautopilot script, respond to prompts, and enter your credentials to upload it to your system. In this guide, I’ll demonstrate how to streamline this process to minimize the number of steps required.

App Registration:

To streamline the process and avoid repeatedly entering credentials, it’s essential to register an app in Azure. Follow these steps:

  1. Navigate to “App Registrations.”(Entra)
  2. Select “New Registration.”
  3. Enter “Autopilot Registration” as the name and click “Register.”
  4. Go to “API Permissions” and select “Add a permission.”
  5. Choose “Microsoft Graph” and then “Application permissions.”
  6. Look for “DeviceManagementServiceConfig.ReadWrite.All,” select the checkbox, and click “Add Permissions.”
  1. Grant admin consent for your domain.
  2. Under “Certificates & secrets,” create a new client secret with a preferred duration.
  3. Copy the secret value securely.
  4. Save the “Application (client) ID” and “Directory (tenant) ID.”

Creating the Scripts:

Now that we have registered an application for authentication, we can create two script files that will simplify the process. You can store these scripts on a USB drive for easy access. Copy the following contents into two separate files named autopilot.cmd and autopilot.ps1:

autopilot.cmd:

powershell.exe -executionpolicy bypass -file .\autopilot.ps1

autopilot.ps1:

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Confirm:$false -Force:$true Install-Script get-windowsautopilotinfo -Confirm:$false -Force:$true get-windowsautopilotinfo -Online -TenantId xxxx -AppId xxxx -AppSecret xxxx shutdown.exe /s /t 30

Running the autopilot.cmd

When your device reaches the first OOBE (Out Of Box Experience) screen, follow these steps:

  1. Press Shift-F10 to open a command prompt.
  2. Navigate to your USB drive (e.g., enter “E:”).
  3. Execute the script by entering “autopilot.cmd.”

The autopilot.ps1 script will then proceed to install necessary components, retrieve the hardware hash, connect to your tenant using the registered app details, and upload the hardware hash. After completion, the system will shut down, and your device will be ready for Autopilot installation.

Adding a Group Tag

If you’re utilizing Group tags for deployment profiles, you can modify the autopilot.ps1 script on your USB drive as follows:

powershell script :

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Confirm:$false -Force:$true 

Install-Script get-windowsautopilotinfo -Confirm:$false -Force:$true 

get-windowsautopilotinfo -Online -TenantId xxxx -AppId xxxx -AppSecret xxxx 

-GroupTag Desktop 

shutdown.exe /s /t 30

Simply add the “-GroupTag” parameter followed by your desired tag (e.g., “Desktop”).

Leave a Reply

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

Back to top button