Enable Global catalog

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)            

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.

This entry was posted in PowerShell and Active Directory. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s