Forum Discussion

mheinst's avatar
mheinst
Copper Contributor
Nov 02, 2023

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

Resources