Friday, 28 November 2008

Get-Forest.ps1


# Get-Forest.ps1
# Shows use of GetCurrentForest to return information about the forest
# Thomas Lee - tfl@psp.co.uk

$forest = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()
"You are connected to the {0} forest" -f $forest.name

This script produces the following output:


PS C:\fool> .\get-forest.ps1
You are connected to the cookham.net forest

0 comments: