I did the same installation in Windows 11 Home and got the same error. I tried unchecking and checking Hyper-V in windows features, start the service manually using "net start vmms" and "sc.exe start vmms". After that didn't work, I reinstalled Windows using Settings > Windows Update > Advanced Options > Recovery > Fix problems using Windows Update. Then ran the script again to install Hyper-V and Hyper-V Virtual machine management service shows up in services and it works. I don't know if this deletes previous Hyper-V virtual machines.