Windows AutoPilot Hardware ID Gather Script

I’m currently looking into setting up Windows AutoPilot for a number of our customers and as part of the setup, there is a requirement to obtain the hardware ID from the device and add it to intune.

The process for obtaining the hardware ID is by installing and running a PowerShell script, running the script with the -OutputFile flag to a CSV then uploading that CSV to the Intune portal.

Is it possible that we can get a C1 script that can install and run the script and then log a ticket with the CSV attached to reduce the connection requirements to customer devices for this.

Script can be found -

Hi @curatrix_pl

we will analyze your request will update you once the script has been completed.

Thank you

Hi @curatrix_pl

We have Finished Your script Request.

please refer the following json

Let us know your feedback


20180607-autopilot.json (2.04 KB)

Thanks for the script. I’ve imported and tested. unfortunately, it comes up as failed on the test machine i have used.

2018/06/20 10:50:23 AM    Failed    

WindowsAutoPilotInfo Script Installation Started...

Name                           Version          Source           Summary       
----                           -------          ------           -------       
nuget                        https://onege... NuGet provi...

Traceback (most recent call last):
  File "<string>", line 28, in <module>
  File "<string>", line 14, in pilot
WindowsError: [Error 2] The system cannot find the file specified: 'C:\\Program Files\\WindowsPowerShell\\Scripts'

Hai @curatrix_pl ,

Thanks for your feedback we will rectify the error and provide you a new script.

Thank You

Hi @curatrix_pl

Now we have updated the script Hope this will satisfy your needs.

Refer the below json

Let us know your feedback


20180621-pilot.json (3.27 KB)

Many thanks

I’ve now tested the update. I have found that it generates the CSV now, however, it is not formatted correctly and doesn’t log a ticket with this as an attachment.

The formatting of the CSV requires us to go in and update the CSV by hand. The formatting issues are as follows:

  • Extra comma on the 'Row Titles' row
  • Each value is seperated by a comma and 2 line breaks.

Hi @curatrix_pl
The script developers have been informed already of your observations. They will reply here soon enough with the updated version of the requested script.

Many Thanks

Hi @curatrix_pl

Sorry for the inconvenience, We have made the changes to the script.
Refer the attached json

Give back your valuable feedback


20180702-windowsautopilot.json (3.29 KB)

Having still had issues with the attached script, i’ve reviewed and re-written it based on my test results as follows:

import os

print "Generating the Windows AutoPilot Info ..............."

os.system('powershell "Install-Script -Name Get-WindowsAutoPilotInfo -Force:$true"')
os.system('powershell "Get-WindowsAutoPilotInfo -OutputFile C:\ProgramData\AutoPilot.csv"')

ps_command=r'Get-Content AutoPilot.csv'

import subprocess
import ctypes

class disable_file_system_redirection:
    _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
    _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
    def __enter__(self):
        self.old_value = ctypes.c_long()
        self.success = self._disable(ctypes.byref(self.old_value))
    def __exit__(self, type, value, traceback):
        if self.success:

with disable_file_system_redirection():
    process=subprocess.Popen('powershell "%s"'%ps_command, shell=True, stdout=subprocess.PIPE)

print result

Hello @curatrix_pl

We have analyzed your scripting part and found some flaws in it so we’re trying to resolve it through the session but it seems good for you right.

Thank you for your concern.

What flaws do you refer too?

The script seems to work fine for the Windows 10 Devices i’ve run it against, and it prints the output in ITSM so i dont have to arrange FTP / File Transfer from the device of the CSV. Ideally, i would like the script to create a ticket in helpdesk, but understand that may not currently be achievable.

Hi @curatrix_pl

Actually, We have done the same methodology as before and also share with you but you have faced some error at the time so we have tried some different way to achieve your goals. In order to use the Microsoft official documented Power Shell scripts which require some power shell modules called Nuget. and also they have skipped the product key in the script as well. If your system doesn’t have the nuget module that might problem and also I have quoted some useless sequence of code. From our analysis this windowsautopilot mode is only working with the physical environment not in virtual environment. Anyway we are happy have a customer like you with the technical knowledge.

Thanks for your valuable feedback and work.