PoshCode Archive  Artifact [a1e3c86580]

Artifact a1e3c865806de5ba81e3a62d76fc5159c0098f5fc0e083477bbca9de43daba97:

  • File Forest-FSMO.ps1 — part of check-in [31011a915c] at 2018-06-10 14:06:31 on branch trunk — Display the FSMO role holders of each domain in your forest. (user: Geoff Guynn size: 1209)

# encoding: ascii
# api: powershell
# title: Forest FSMO
# description: Display the FSMO role holders of each domain in your forest.
# version: 0.1
# type: script
# author: Geoff Guynn
# license: CC0
# x-poshcode-id: 6031
# x-archived: 2016-05-17T13:07:31
# x-published: 2016-09-26T00:51:00
#
#
#Script Author Information
$script:ProgramName = "Forest FSMO"
$script:ProgramDate = "11 Dec 2013"
$script:ProgramAuthor = "Geoffrey Guynn"
$script:ProgramAuthorEmail = [System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String("Z2VvZmZyZXlAZ3V5bm4ub3Jn"))

$Forest = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()
$ChildDomains = $Forest.Domains
$SchemaRole = $Forest.SchemaRoleOwner
$NamingRole = $Forest.NamingRoleOwner

$DomainObjects = @()

$ChildDomains | % {

    $CurrentDomain = $_
    
    $objDomain = $CurrentDomain | Select Name, Forest, PDCRoleOwner, RidRoleOwner, InfrastructureRoleOwner
    $objDomain | Add-Member -MemberType NoteProperty -Name SchemaRole -Value $SchemaRole
    $objDomain | Add-Member -MemberType NoteProperty -Name NamingRole -Value $NamingRole
    
    $DomainObjects += $objDomain
}

$DomainObjects