header image

Enable Global catalog

Posted by: | March 18, 2012 | No Comment |

Enabling a domain controller is simple through the GUI however its just even easier with PowerShell

$dc = "dc02.manticore.org"            
$contextType = [System.DirectoryServices.ActiveDirectory.DirectoryContextType]::DirectoryServer            
$context = New-Object -TypeName System.DirectoryServices.ActiveDirectory.DirectoryContext -ArgumentList $contextType, $dc            
$gc = [System.DirectoryServices.ActiveDirectory.DomainController]::GetDomainController($context)            
$gc.EnableGlobalCatalog()

Create a context type of Directory Server. Create a context of that type for the domain controller to be promoted. Get the domain controller as a System.DirectoryServices.ActiveDirectory.DomainController object and call the EnableGlobalCatalog() method.

There is an alternative using ADSI but I think this is simpler. Put it in a function with the domain controller name as a parameter and its good to go.

under: PowerShell and Active Directory