Tech Community Live: Endpoint Manager edition
Jul 21 2022, 08:00 AM - 12:00 PM (PDT)

Retrieve device info from CMD for autopilot

%3CLINGO-SUB%20id%3D%22lingo-sub-3054179%22%20slang%3D%22en-US%22%3ERetrieve%20device%20info%20from%20CMD%20for%20autopilot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3054179%22%20slang%3D%22en-US%22%3E%3CDIV%3EHi%20all%2C%20I%20want%20to%20start%20using%20AutoPilot%20on%20some%20devices%2C%20but%20I%20am%20getting%20issues%20with%20sending%20device%20info%20into%20%22Windows%20Autopilot%20Devices%22%20in%20intune.%20When%20I%20am%20on%20the%20OOBE%20of%20a%20device%20I%20press%20Shift%20%2B%20F10%20to%20get%20CMD%2C%20then%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3COL%3E%3CLI%3E%3CSPAN%3EPowershell%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3ESet-Executionpolicy%20bypass%3C%2FLI%3E%3CLI%3EInstall-Script%20Get-WindowsAutoPilotInfo%3C%2FLI%3E%3C%2FOL%3E%3CDIV%3EI%20then%20Select%20Y%20which%20works%20for%20the%20first%20but%20then%20on%20the%20second%20I%20get%20an%20error%3A%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22AB21805_0-1641548425556.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F337946i44325ECB354837F0%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22AB21805_0-1641548425556.jpeg%22%20alt%3D%22AB21805_0-1641548425556.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EAny%20ideas%20why%20this%20is%20failing%3F%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3054179%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Friday%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EConditional%20Access%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EGraph%20API%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EIntune%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMobile%20Application%20Management%20(MAM)%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMobile%20Device%20Management%20(MDM)%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESoftware%20Management%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Super Contributor
Hi all, I want to start using AutoPilot on some devices, but I am getting issues with sending device info into "Windows Autopilot Devices" in intune. When I am on the OOBE of a device I press Shift + F10 to get CMD, then
 
  1. Powershell
  2. Set-Executionpolicy bypass
  3. Install-Script Get-WindowsAutoPilotInfo
I then Select Y which works for the first but then on the second I get an error: 
 
AB21805_0-1641548425556.jpeg

 

 
Any ideas why this is failing? 
10 Replies
I've never had this issue personally, however i have always plugged in a USB with the Script on so i can easily extract the CSV file and import it on demand.
Hi, How do I do this?

You could try this command line to get a better error output

Install-Script -Name Get-WindowsAutopilotInfo -Force -Verbose -Debug

Another possibility would be to indeed download the get-windowsautopilot.ps1 file and place it on a USB stick... We are also doing the same and built in some additional checks
Hi Rudy

Where would I find the get-windowsautopilot.ps1 and how would I run it from cmd after running powershell?
Hi

You could search the powershell galery https://www.powershellgallery.com/packages/Get-WindowsAutoPilotInfo/3.5

Download it and save it something like autopilot.ps1 you can run it like this (if the cmd is in the same folder as the autopilot file)

powershell.exe -executionpolicy bypass .\autopilot.ps1
I have used powershell.exe -executionpolicy bypass D:\Get-WindowsAutopiletinfo.ps1

this works however the details needed for intune go into the cmd window ideally it would be great if this could go straight into intune. I have seen this done by adding -online but I cant seem to get it to work or if this isnt possible how to I add it to a csv on to the memory stick
Normally it would be

Get-WindowsAutoPilotInfo.ps1 -online -addtogroup “AutoPilotstaticgroup” -assign

You can also download the autopilot module from this blog as I am not sure if the one you downloaded it totally up to date

https://call4cloud.nl/2020/10/autopilot-the-group-membership-war/

Hi @Rudy_Ooms_MVP 

 

I keep getting this, I know I have changed it so just using the online switch but stlll no luck even with the ps1 from the link provided. 

 

Screenshot 2022-01-07 at 12.42.10 PM.png

 

ANy ideas? 

 

Did you saved the get-windowsautopilot file in the system32 folder?

Hi @Rudy_Ooms_MVP 

 

No its not do I need to move it there? How do I get to the System32 folder via cmd window? 

 

I had the get-windowsautopilot file  on a memory stick