Just today the "Father" of Windows Autopilot (Michael Niehaus) just wrote a great article about Windows Autopilot diagnostics. And I just refer to this article for you and me for later use.
He is speaking about the "GET-AutopilotESPStatus" and its evolution to the Powershell Commandlet "Get-AutopilotDiagnostics" which it is now. And also about the different steps and even much more stuff to dig deeper into Autopilot diagnostics.
Feel free to have a deeper look into the Windows Autopilot diagnostics here:
https://oofhours.com/2020/07/12/windows-autopilot-diagnostics-digging-deeper/
And you get the original script here:
https://www.powershellgallery.com/packages/Get-AutopilotDiagnostics