Jayaprabhan
asked on
How to Check whether a machine is domain controller or not?
Hello,
What is the best way to identify a machine is a domain controller not apart from checking manually.?Is there a registry key which has a domain controller name.I tried with this key "HKLM\Software\Microsoft\M SMQ\Parame ters\Setup key but it doesn't help.This key contains value for Domain Controller even in domain machines.
There are few applications that doesn't run properly on the domain controller.I have to do a preinstall check whether a machine is a domain controller or not when the user tries to install the application?.If its a domain controller ,then i will not allow the install.
Is there a way to get this?
What is the best way to identify a machine is a domain controller not apart from checking manually.?Is there a registry key which has a domain controller name.I tried with this key "HKLM\Software\Microsoft\M
There are few applications that doesn't run properly on the domain controller.I have to do a preinstall check whether a machine is a domain controller or not when the user tries to install the application?.If its a domain controller ,then i will not allow the install.
Is there a way to get this?
do an LDAP query on the domain controllers OU
You could try this script (or just take out the parts you need)
http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true
http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true
Well, that didn't work. Here's the script I was linking to.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputers = objWMIService.ExecQuery _
("Select DomainRole from Win32_ComputerSystem")
For Each objComputer in colComputers
Select Case objComputer.DomainRole
Case 0
strComputerRole = "Standalone Workstation"
Case 1
strComputerRole = "Member Workstation"
Case 2
strComputerRole = "Standalone Server"
Case 3
strComputerRole = "Member Server"
Case 4
strComputerRole = "Backup Domain Controller"
Case 5
strComputerRole = "Primary Domain Controller"
End Select
Wscript.Echo strComputerRole
Next
ASKER
Thanks a lot.Your script solved my problm.
CrashDummy's script should do the job.
Note that using that script on an Active Directory domain controller will return a 4 (Backup Domain Controller) unless the DC has the PDC Emulator role, then it will return a 5 (Primary Domain Controller)
Note that using that script on an Active Directory domain controller will return a 4 (Backup Domain Controller) unless the DC has the PDC Emulator role, then it will return a 5 (Primary Domain Controller)
HKEY_LOCAL_MACHINE\System\ CurrentCon trolSet\Co ntrol\Prod uctOptions , value ProductType
ASKER
What is the property name to get the FQDN if its an domain controller.I tried with Obj.Name but it returns only the Domain but not the Fully Qualified Name.Is there a way to get the FQDN or the Full computer Name
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot .I am able to get the name now.