Need to use Group managed service account to fetch Hyper-V data
I have single machine (VM) running Windows server 2019 acting as both the Domain Controller (DC) and running Hyper-V service and want to fetch Hyper-V VMs data using Group managed service account. I have followed below steps but when I run 'Invoke-Command' to fetch the VM details, it is prompting for gMSA password though windows doesn't allow to set any password Group managed service account.
Add-KdsRootKey -EffectiveTime ((Get-Date).AddHours(-10))
New-ADServiceAccount -Name HyperVGMSA -DNSHostName HyperVGMSA.hyperv.local -PrincipalsAllowedToRetrieveManagedPassword "Win19-50-8-80$"
Install-ADServiceAccount HyperVgMSA
Test-ADServiceAccount HyperVgMSA
$service = Get-WmiObject Win32_Service -Filter "Name='vmms'"
Enable-PSRemoting -Force
Prompting for password while entering below command
Invoke-Command -ComputerName YourDC -Credential YOURDOMAIN\HyperVgMSA$ -ScriptBlock { Get-VM }