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.
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)
call powershell.exe -ExecutionPolicy ByPass -Command "$null=Install-PackageProvider -Name NuGet -MinimumVersion 22.214.171.124 -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
Custom Inventory Field
Results look like: