Domain controllers use a KDS root key to work out each gMSA's password. Create it once for the forest. Every gMSA you make later uses the same key.
Check whether a key exists
A domain controller
Get-KdsRootKey | Select-Object KeyId, EffectiveTime
If it lists a key with an effective time in the past, skip to the next page.
Create the key
A domain controller
Add-KdsRootKey -EffectiveImmediately
Despite the name, the key becomes usable 10 hours later. The wait gives every domain controller time to receive it. Create it at the end of the day and carry on the next morning.
Test labs only: skip the wait
Add-KdsRootKey -EffectiveTime ((Get-Date).AddHours(-10)) back-dates the key so it works at once. With more than one domain controller, a DC that has not received the key yet will refuse password requests. Use this in a lab only; in a school, wait.
Done when
Check
Get-KdsRootKey lists one key, and its EffectiveTime has passed.


