Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save norman-bauer/fcc470770f4aa22ac2abfaa2ec4cc2ec to your computer and use it in GitHub Desktop.

Select an option

Save norman-bauer/fcc470770f4aa22ac2abfaa2ec4cc2ec to your computer and use it in GitHub Desktop.
$schemaContext = Get-ADRootDSE | %{$_.schemaNamingContext}
Foreach ($dc in ([System.DirectoryServices.ActiveDirectory.DomainController]::findall(
(new-object System.DirectoryServices.ActiveDirectory.DirectoryContext("Domain",$env:USERDNSDOMAIN)))) |
%{$_.name})
{
$path = ‘LDAP://’ + $dc + ‘/’ + $schemaContext
$Object = [adsi]$path
$dc + ‘ ‘ + $Object.objectversion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment