Deploy a Hyper-V VM and register it for Autopilot automatically using PowerShell

For Endpoint Manager testing I need a VM connected to the tenant of the customer. This involves deploying a Windows 10 or 11 VM, changing hardware settings on it (Secure Boot/TPM/Checkpoint settings), and registering it for Autopilot. This blog post will show you how to automate the process as much as possible.