AutoPilot Hardware hash error, You cannot call a method on a null-valued expression

Copper Contributor

When we trying to download the hardware hash for Autopilot via Powershell, we recently are getting null-valued expression errors on random laptops W11P laptops . 

So far on W10P we never hard problems.


Is there a way to exclude $model, $make? 

Or can we adjust the script?


our script:


echo Enabling WinRM

PowerShell -NoProfile -ExecutionPolicy Unrestricted -Command Enable-PSRemoting -SkipNetworkProfileCheck -Force

echo Gathering AutoPilot Hash

PowerShell -NoProfile -ExecutionPolicy Unrestricted -Command %~dp0Get-WindowsAutoPilotInfo.ps1 -ComputerName $env:computername -OutputFile %~dp0compHash.csv -append

echo Done!


null-valued expression errornull-valued expression error

4 Replies
What happens when running this command.

$wmi = Get-WMIObject -Namespace root/cimv2/mdm/dmmap -Class MDM_DevDetail_Ext01 -Filter "InstanceID='Ext' AND ParentID='./DevDetail'"
I am using the 3.9 version and still run into the same issue with Win11. Would you be able to help?

Restarting the computer was our solution. And always make sure you have the latest version. @dnisavicvmoxcom