I have a script that will run on multiple Servers that start out as Windows Server 2016 in a workgroup
If a Domain controller doesn't exists (ABC.COM) Then Promote the Server to Primary Domain Controller creating ABC.COM
If a Domain controller does exist then Promote the Server to Domain Controller joining ABC.COM
If a server is in a workgroup the command Get-ADDomain -Identity "DC=ABC,dc=com" does not return the PDC if it exists.
So what would my powershell function have to be ?
DoesPDCExist
{
#return true if PDC exists
#return false if PDS does not exist
}