SOLVED

Collect Autopilot hashes without big user interaction?

Brass Contributor

Hi there,

 

is there a way to collect the hashes for the autopilot from existing local Windows 10/11 devices without guiding the user through a powershell script?

You can also export the management protocols directly via the GUI, is there perhaps a batch for this?

w10-export-logs

Thanks a lot

3 Replies
best response confirmed by Mykey (Brass Contributor)
Solution

Ok I think I have the solution, with admin rights and the command
mdmdiagnosticstool.exe -area "Autopilot" -zip "c:\users\public\documents\MDMDiagReport.zip"

I successfully get a hardware hash.

I ended up using a "custom" version of the Get-WindowsAutoPilotInfo process.
Rather than running locally I created a script that would run it, export to a CSV based on the PC name and export to Azure Blob storage or you could export to a file share if you'd prefer:

I then set a PowerShell script to run from Intune, you could use SCCM I guess also if that is what you use.

you could use the append option to create a single file in a network share. I used Azure Data Factory to merge the CSV's in to one list once it had run.

#Setup the basics: Folder, Path etc...
New-Item -Type Directory -Path "C:\HWID"
Set-Location -Path "C:\HWID"
$env:Path += ";C:\Program Files\WindowsPowerShell\Scripts"
Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned

#Install NuGet and the Get-AutoPilotInfo scrript
Install-PackageProvider -Name NuGet -Force
Install-Script -Name Get-WindowsAutoPilotInfo -force

#Download and install AzCopy
Invoke-WebRequest -Uri "https://aka.ms/downloadazcopy-v10-windows" -OutFile AzCopy.zip -UseBasicParsing
#Curl.exe option (Windows 10 Spring 2018 Update (or later))
curl.exe -L -o AzCopy.zip https://aka.ms/downloadazcopy-v10-windows
#Expand Archive
Expand-Archive ./AzCopy.zip ./AzCopy -Force
#Move AzCopy to the destination you want to store it
Get-ChildItem ./AzCopy/*/azcopy.exe | Move-Item -Destination "C:\HWID\AzCopy.exe"
#Add your AzCopy path to the Windows environment PATH
$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User")
[System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";C:\HWID\AzCopy", "User")

#Get the Hardware ID:
Get-WindowsAutopilotInfo -OutputFile "$env:COMPUTERNAME.csv"
#Copy the CSV to Azure Blob Storage
.\azcopy.exe copy "c:\HWID\$env:COMPUTERNAME.csv" "https://mystorage.blob.core.windows.net/autopilot?sp=rw&st=2023-04-10T13:30:52Z&se=2023-08-30T21:30:...dfdg" --recursive

#Cleanup
Set-Location -Path "C:\"
Remove-Item -LiteralPath "c:\HWID" -Force -Recurse
Uninstall-Script Get-WindowsAutoPilotInfo

hello @andrewkemp79 

As info for you: As I am sure you have noticed, the Get-WindowsAutoPilotInfo script and associated WindowsAutoPilotIntune module have been updated and whether you are using the official one, the authentication method has changed to the Microsoft.Graph SDK.

 

 

link: https://andrewstaylor.com/2023/06/13/authenticating-to-new-get-windowsautopilotinfo/

 

1 best response

Accepted Solutions
best response confirmed by Mykey (Brass Contributor)
Solution

Ok I think I have the solution, with admin rights and the command
mdmdiagnosticstool.exe -area "Autopilot" -zip "c:\users\public\documents\MDMDiagReport.zip"

I successfully get a hardware hash.

View solution in original post