Hello,
Thank you so much for posting here.
According to our description, we would like to create a script we could use on a GPO to collect the hardware hash from all the devices and save it to a file. It seems to be more like a script issue. We are sorry that we are not professional with script issue.
Hope something here might be helpful.
https://learn.microsoft.com/en-us/mem/autopilot/add-devices
If we have any question about the Powershell script, we could go to https://learn.microsoft.com/en-us/answers/topics/windows-server-powershell.html for more assistance.
Thank you so much for your understanding and support.
Best regards,
Hannah Xiong