Azure Autopilot info via Get-WindowsAutoPilotInfo.ps1 - Getting empty results

Trying to capture hardware ID using a script from https://www.powershellgallery.com/packages/Get-WindowsAutoPilotInfo/2.1 for our Upcomign Azure AD deployment, but having no luck so far. We have plenty of PS1 and bat files already setup, even using x86 and x64 environments.  By using 2&>1, @echo ON and etc, it seems script can't resolve hostname, but it's optional parameter really. Tried localhost, %hostname%, $env:computername  "$env:computername", $(env:computername ) and a lot of other crazy stuff to get this working. No luck alas. So far the only progress is empty file output created for this. 

tried via bat, PS1 files, coupled with SYSTEM , admin accounts and etc. 

Any advice is highly appreciated.

Thanks guys

1 Comment   [ + ] Show comment
  • I posted an answer that worked for me. It is waiting to get through the mod filter. - Logan5 5 months ago

Answers (1)

Posted by: Logan5 5 months ago
White Belt

Microsoft AutoPilot/InTune Hardware Hash / Hardware ID

I know that this is an old question, but I think that I was able to do it with a combination of BAT making powershell calls, Custom Inventory Field (CIF), and File Synchronization, leveraging the CIF.

BAT commands:  (This BAT should be part of the CIF)

(There are probably better ways to do this.  I'm not great with BATs or PowerShell)


@Echo Off

call powershell.exe -ExecutionPolicy ByPass -Command "$null=Install-PackageProvider -Name NuGet -MinimumVersion -Force"

call powershell.exe -ExecutionPolicy ByPass -Command "$null=Install-Script -Name Get-WindowsAutoPilotInfo -force"

call powershell.exe -ExecutionPolicy ByPass -Command "& $env:ProgramFiles\WindowsPowerShell\Scripts\Get-WindowsAutoPilotInfo.ps1 -OutputFile AutoPilotHWID.CSV">NUL

type AutoPilotHWID.CSV


Custom Inventory Field


Results look like:


Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ