Windows Autopilot

Importing a device hash directly into Intune

I resisted the urge to add a switch to the Get-WindowsAutopilotInfo script to add the device to Windows Autopilot using the Intune Graph API.  But since people were doing it anyway in worse ways (e.g. writing their own scripts and not leveraging the functionality that was already available, e.g. taking the CSV from Get-WindowsAutopilotInfo and feeding it to the WindowsAutopilotIntune module), I gave in and added a new “-Online” switch that will take care of it.

image

If you add “-online” it will prompt for credentials for the Intune Graph API (installing the WindowsAutopilotIntune, Microsoft.Graph.Intune, and AzureAD modules if needed), then create the CSV file (and if you don’t specify a path for that CSV file via -outputFile it will create one in the %TEMP% folder), and finally passes that to the Import-AutopilotCSV function in the WindowsAutopilotIntune module.  You’ll see the “Waiting” messages until the process is done.  (That doesn’t mean the device is ready to deploy, as you still need to make sure that it has an Autopilot profile assigned to it.)

image

Here’s what the whole process looks like (edited for time – there is an extra delay before the Azure AD authentication, and it takes a while to complete the import):

Categories: Windows Autopilot

2 replies »

  1. THAT is insanely useful! I have created a small script that sets execution policy, run get-windowsautopilotinfo and then installs and run PSWindowsupdate and reboot automatically. I will definitely streamline this process further with -online. Thanks Michael!

    Like

  2. Thank you! I have resisted writing scripts for my customer with “online” function as I know they would use them wrongly, but today I needed to prepare several VM for testing and this is sooo useful 🙂

    Like