Might also try from the GUI Add / Remove Roles in Server Manager. Also check the log files for clues.
https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/deploy/troubleshooting-domain-controller-deployment
--please don't forget to upvote and Accept as answer if the reply is helpful--