Forum Discussion
AutoPilot Hardware hash error, You cannot call a method on a null-valued expression
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 OFF
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!
pause
null-valued expression error
5 Replies
- deltavictorindialimaCopper Contributor
Remove the -ComputerName $env:computername parameter. It probably utilizes WMIC which is deprecated in Windows 11
- What happens when running this command.
$wmi = Get-WMIObject -Namespace root/cimv2/mdm/dmmap -Class MDM_DevDetail_Ext01 -Filter "InstanceID='Ext' AND ParentID='./DevDetail'"
$wmi.DeviceHardwareData- Techoutlet-euCopper ContributorFound the solution, create a new usb with 3.9 version. We had an order version.
https://www.powershellgallery.com/packages/Get-WindowsAutoPilotInfo/3.5- dnisavicvmoxcomCopper ContributorI am using the 3.9 version and still run into the same issue with Win11. Would you be able to help?