Skip to content

Instant AutoPilot Command

These Commands can be run to obtain the Hardware Hash and store in a CSV locally or upload directly to the Intune Tenant. This bypasses any Execution Policy and other prompts. The Execution Policy is automatically set to run the script only. Works great on OOBE Shift+F10, Now supports GroupTags and Device naming.
Short URL to this page:

Version History

v1.0 – 10th June 2020 – Public Release
v.1.1 – 18th February 2021 – Added Switches for Tenant Upload and GroupTag option
v1.2  – 20th February 2021 – Updated Get-WindowsAutoPilotInfo.ps1 script v2.3 > v3.5
v1.3  – 22nd February 2021 – Added Devicename switch

Tested On

Windows 10 Pro x64 1909, 2004, 20H2


To open Wifi networks on OOBE:

start ms-availablenetworks: 

This is required if you want to obtain the Hardware ID before the Wifi connection screen which checks the connection to the Intune Tenant

One Line CMD local CSV file only:

curl -L > ap.bat & ap.bat l

l switch = local
One Line PowerShell: curl.exe -L -o ap.bat; .\ap.bat l
Note: On the OOBE CMD window the default path is C:\Windows\System32 I usually change the path to C:\Windows\Temp if saving a local csv file.
Full One Line Command with path change included: cd c:\windows\temp & curl -L -# -o ap.bat & ap.bat l
(optional switches -# Progress bar, -s silent mode) you can replace > with -o if required.

One Line CMD local CSV with custom GroupTag :

curl -L > ap.bat & ap.bat lg DEV

lg switch = local grouptag
After the lg switch specify your GroupTag in lower or uppercase as shown above as DEV
One Line PowerShell: curl.exe -L -o ap.bat; .\ap.bat lg DEV

One line CMD Upload to Tenant Only:

curl -L > ap.bat & ap.bat o

o switch = online
One Line PowerShell: curl.exe -L -o ap.bat; .\ap.bat o

One line CMD Upload to Tenant with custom GroupTag:

curl -L > ap.bat & ap.bat og kiosk

og switch = online grouptag
After the og switch specify your GroupTag in lower or uppercase as shown above as kiosk
One Line PowerShell: curl.exe -L -o ap.bat; .\ap.bat og kiosk

One line CMD Upload to Tenant with custom Devicename:

curl -L > ap.bat & ap.bat od surface01

od switch = online devicename
After the od switch specify your Devicename in lower or uppercase as shown above as surface01
One Line PowerShell: curl.exe -L -o ap.bat; .\ap.bat od surface01

Optional: Start Edge browser (Used to email CSV file from OOBE)


The above command is optional. It can be used by a user to email an Engineer their CSV file if required.

Optional: Shutdown computer in OOBE

shutdown /s /t 00

If you are setting up a laptop for a user and have obtained and uploaded the hardware id. Enter the above command in CMD to safely shutdown the laptop ready to give to a user to enroll.


The sudden global shift to remote working last Summer meant there was a rush to get hold of laptops by many Organisations. There was a shortage and in some cases we had to obtain off the shelf retail laptops. I wanted to develop a quick way to collect Autopilot Hardware ID’s. Initially I created a batch script called Get-Autopilot HWID. This runs the PowerShell script without having to enter the individual commands in a PowerShell window. This was good from a USB stick as it appended multiple hardware id’s into the same csv file.

I developed this further into a short url command which runs from the cloud. This can be run on any internet connected computer in an admin CMD or PowerShell window. It takes around 4 seconds to generate the csv from a device locally and can be done by admins or end users.

How This Works?

This uses a built in Command line tool Curl to download a batch script which then runs Michael’s original AutoPilot PowerShell script.
Curl goes back 23 years It’s built into Unix/Linux/MacOS but was added in Windows 10 1803 (March 2018).
What this essentially does is it wraps the PowerShell script and runs it via Batch Script automatically. The Batch file is wrapped in a short URL and downloaded using Curl.


  • Very Fast around 4 seconds
  • Run as many times as required
  • Runs in OOBE and on Desktop
  • Runs on all Windows Versions
  • No data is collected everything is run on the device locally
  • Easy command that can be typed by end users
  • Original PowerShell script is unmodified and new versions are updated in the Repo
  • Can be run from a USB path on multiple devices which appends the IDs into the same csv file on the USB
  • Works in PowerShell too


Can this break?
Not easily, it runs on Azure DevOps which has a 99.9% availability guarantee. I can mirror host on GitHub servers if needed. Github has a 99.95% uptime guarantee. Rebrandly URL shortener have a 99.9% service uptime guarantee hosted on Amazon S3 in multiple countries with rapid autoscaling infrastructure. The path to the source files can easily be modified in Link Manager to point to GitHub if ever required.

Is it Secure?
Yes it uses KCS #1 SHA-256 With RSA Encryption from Microsoft. Rebrandly hosting uses SSL from Let’s Encrypt.
Authentication to your tenant is done using Graph API and AzureAD

Is this the fastest way to get a computer hardware ID?
Possibly, if there is another way please let me know or any feedback on how it can be improved.

Why is it hosted on Azure DevOps?
I found Azure DevOps faster than GitHub when accessing downloading files from Repos and in general. The goal was to make this script as fast as possible. I will look to do a performance comparison in future.

Are there any limits?
This can be run as many times as required

Does this cost anything?
It’s free

Does this collect or save my Autopilot ID?
The files are downloaded and run locally on the computer. These are removed leaving only the CSV file on the device.

What about changes?
Some performance related changes are coming soon. Keep track of this page for any future changes

These commands are mainly for testing purposes such as VM’s that you want to quickly get up and running. Generally speaking you would use a Vendor’s Autopilot Team to manage your devices Hardware ID’s.

0 0 votes
Article Rating
Share this Post
Notify of
Newest Most Voted
Inline Feedbacks
View all comments
Bodek Frak
Bodek Frak
8 months ago

This is a great method!. Thank you for making this available. Is there a possibility of adding a switch that allows to set both the group tag and device name while uploading to the tenant?

Would love your thoughts, please comment.x