Question: how to check if server is domain controller?
Answer: Using the DomainRole property of the ComputerSystem class is a useful and fast way to check whether a Server Core installation of Windows Server is a Domain Controller, whether it's domain-joined and whether it holds the PDCe FSMO role.