Server Core installations of Windows Server 2008 can be utilized in a variety of ways. I’ve written about using them as Web 2.0 Servers with IIS 7, PHP and MySQL, as Streaming media (reverse) proxies, as branch office servers, loaded with DFS, DNS, DHCP and secured with BitLocker Drive Encryption and of course using them as highly-optimized Active Directory Domain Controllers.
But, how exactly do you tell whether a Server Core box is a Domain Controller?
The command to check this is actually surprisingly simple:
wmic.exe ComputerSystem get DomainRole
But the output is puzzling, to say the least…
In the screenshot above the command returns a numeric value.
Again, just like when you want to find out what edition of Windows Server you’re running, deciphering the value to something that makes sense to humans is key to get the info.
The table to use to decipher the DomainRole value can be found on the MSDN page of the ComputerSystem class:
|4||0x4||Backup Domain Controller|
|5||0x5||Primary Domain Controller|
In the screenshot above the returned value is 5, which means the Server Core installation is, in fact, a Domain Controller. Not just a Domain Controller though… It’s the Domain Controller holding the Primary Domain Controller emulator (PDCe) Flexible Single Master Operations (FSMO) role.
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.
How to Check whether a machine is domain controller or not?
How can I determine if a server is a domain controller?
Determining If a Machine is a Domain Controller
How can a script determine if the computer it is running on is a Domain Controller?
Identifying read only domain controller through WMI : DOTNET
Determine the Primary Domain Controler
Hey, Scripting Guy! How Can I Tell Whether a Logon Script is Running on a Workstation or on a Server?