PS: Get-ADEnvironment

This script quickly creates an overview of you ADDS environment. It shows up Forest and domain functional levels, FSMO role holders and domaincontrollers assigned to an ADDS site.

The script is a quick implementation and has no real error handling in it. But to get a quick overview this is enough...


Requirements


Usage

Just call the script.


Script code:

	
Import-Module ActiveDirectory

$forest = Get-ADForest
Write-Host ""
Write-Host -ForeGroundColor Yellow "*** Forest: $($forest.RootDomain) ***"
Write-Host ""
Write-Host "Forest Mode: $($forest.ForestMode)"
Write-Host "Schema Master: $($forest.SchemaMaster)"

$domains = @($forest | Select -ExpandProperty:Domains)

Foreach ($domain in $domains) {
	Write-Host ""
	Write-Host -ForeGroundColor Yellow "*** Domain: $domain ***"
	Write-Host ""
	$domaindetails = Get-ADDomain $domain

	Write-Host "Domain Mode: $($domaindetails.DomainMode)"
	Write-Host "PDC Emulator: $($domaindetails.PDCEmulator)"
	Write-Host "Infrastructure Master: $($domaindetails.InfrastructureMaster)"
	Write-Host "RID Master: $($domaindetails.RIDMaster)"
}

$domaincontrollers = @(Get-ADDomainController -Filter {IsGlobalCatalog -eq $true})
$gcs = $domaincontrollers | Group-Object -Property Site, OperatingSystem | Select-Object @{Expression="Name";Label="Site, OS"},Count | Sort-Object Name
Write-Host ""
Write-Host -ForeGroundColor Yellow "*** Global Catalogs by Site/OS ***"
$gcs | ft -auto
	

>> syntax highlighting powered by highlight.js