Getting Devices Started in Windows Autopilot
Table of Contents

The following article provides you with an easier and faster way to register devices in Windows Autopilot. It saves you the manual process of creating and uploading a CSV file and automates the process for future use.
No time and mood for a time-consuming registration of devices in Windows Autopilot?
Windows Autopilot is a Microsoft Azure service with which you can register devices with identifiers. This works similar to the Apple Device Enrollment program. With the registration, Microsoft Azure gets the necessary information to use the devices and assign profiles. To do this, you run a script that generates a CSV file for the enrollment and then upload it to Windows Autopilot.
To solve the registration with a CSV file unfortunately brings a certain effort with it. The CSV must be created, evaluated and imported. However, I would like to solve the whole thing offline without Azure Automation, since using the Microsoft Azure Automation account costs money. So how can I put a USB stick in someone’s hand, which can then be used to do the automated registration offline on autopilot without logging into my portal?
Alternative registration with ScriptRunner in three steps
1. Prerequisites
- First, I created a Microsoft Azure Enterprise Application called “ScriptRunner-Intune-Connector”.
- Then I gave a service account from my domain access to Application.

Set up application
- Then I gave a service account from my domain access to Application. Now access to Windows Autopilot is possible.
- To allow Application to read & write to the list, I still maintained the necessary permissions.

Grant access and permissions
2. Scripts for ScriptRunner
- As ScriptRunner Action I wrote a script, which addresses the “ScriptRunner-Intune-Connector” and so registers the devices in Windows Autopilot.
- So that the MicrosoftGraphAPI gets the necessary information to address the application, the ApplicationID is used.
The script is structured to extract a username and password from the PSCredential object to generate a token for the application. Then the module “WindowsIntuneAutopilot” is loaded and thus the information is added to Windows Autopilot.

Address Application with ScriptRunner
The action now waits until the device appears in the list and has been synchronized. This ensures that the device has been correctly imported into Windows Autopilot by ScriptRunner.
3. PowerShell functions for automation
- I wrote a Powershell function that addresses the ScriptRunner directly via port 8091 and mimics the Delegate App / Admin App.
- I put this function into a script so that it can be executed from the client.
- The script can now be copied to a USB stick with the Windows installation CD and called directly after installation. Alternatively, the script can also be executed directly at the language selection when the client is booted.
ProTip: In the language selection you can start a command prompt with “Shift+F10”.

Script with PowerShell function for client execution
- Create a Microsoft Azure Enterprise Application
- Grant access to the Application
- Set permissions to read & write
- Creata a ScriptRunner Action for registration
- Use ApplicationID for addressing the application via the Microsoft Graph API
- Write a PowerShell function for delegation/admin execution via port 8091 and put it in a script
- Copy script to a USB drive and run
Conclusion
- a device is installed/booted with Windows 10
- At the language selection just call the command prompt with “Shift+F10”.
- Now run the script and the desired device will be automatically registered in Windows Autopilot
For me, ScriptRunner helped me with the implementation because I could register my devices in Windows Autopilot without much hassle and I didn’t have to spend a lot of time registering devices.
Related Posts
11 min read
Onboarding, Offboarding and Everything in Between – 5 Ideas to Simplify Your Active Directory Management
Feb 17, 2023 by Damian Scoles
About the author:
Daniel Finkenzeller is consultant at AppSphere AG and guest author on the ScriptRunner Tech-Blog.