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.

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.)

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):