Introducing the CPolydorou.ActiveDirectoryLDAP PowerShell module

I've been working with Active Directory for a very long time, even back when there was no PowerShell! Over those years, I've developed some functions to query the directory with the help of .NET and surprisingly those functions are still useful!

I've decided to try to convert them to PowerShell so that the can be an addition to my Active Directory module, when the Remote Server Administration Tools are not available. For that reason, I've created and published a new module named CPolydorou.ActiveDirectoryLDAP on the PowerShell gallery.

At this time, the module contains only two functions, Get-ActiveDirectoryDomainLDAP and Get-ActiveDirectoryForestLDAP. Those two return information about Active Directory domains and forests respectively.

Let's take a look on some examples.

Executing the "Get-ActiveDirectoryDomainLDAP" without parameters, will return information about the domain the local computer is joined to.

PS C:\> Get-ActiveDirectoryDomainLDAP

Name      Forest    DomainModeLevel DomainMode
----      ------    --------------- ----------
lab.local lab.local               6 Windows2012R2Domain

PS C:\>

If you are running the commands on a computer that is not joined to the domain or against a domain controller of another forest, you can specify the server and the credentials to use.

PS C:\> Get-ActiveDirectoryDomainLDAP -Server 10.0.0.11 -Credential $cred 

Name              Forest     DomainModeLevel DomainMode 
----              ------     --------------- ---------- 
client.test.local test.local               4 Windows2008R2Domain

PS C:\>

You may also use the name of the domain:

PS C:\> Get-ActiveDirectoryDomainLDAP -Name lab.local -Credential $cred 

Name      Forest    DomainModeLevel DomainMode 
----      ------    --------------- ---------- 
lab.local lab.local               6 Windows2012R2Domain 

PS C:\>

The "Get-ActiveDirectoryForestLDAP" has the same parameters and usage but it returns forest information:

PS C:\> Get-ActiveDirectoryForestLDAP

Name : lab.local
Sites : {HQ, DR}
Domains : {lab.local}
ForestModeLevel : 6
ForestMode : Windows2012R2Forest
RootDomain : lab.local

PS C:\> Get-ActiveDirectoryForestLDAP -Server 10.0.0.11 -Credential $cred

Name : client.test.local
Sites : {NewYork, London, Athens}
Domains : {client.test.local, test.local}
ForestModeLevel : 4
ForestMode : Windows2008R2Forest
RootDomain : test.local

PS C:\> Get-ActiveDirectoryForestLDAP -Name lab.local -Credential $cred

Name : lab.local
Sites : {HQ, DR}
Domains : {lab.local}
ForestModeLevel : 6
ForestMode : Windows2012R2Forest
RootDomain : lab.local

PS C:\>

More functions are going to be added in the next weeks, so stay tuned!

Popular posts from this blog

Domain Controller Machine Password Reset

Configuring a Certificate on Exchange Receive Connector

Managing Active Directory User Certificates using PowerShell