<# .SYNOPSIS Shows use of GetCurrentForest to return information about the forest .DESCRIPTION This script uses .NET to return name of forest. .NOTES File Name : Get-Forest.ps1 Author : Thomas Lee - tfl@psp.co.uk Requires : PowerShell V2 .LINK http://pshscripts.blogspot.com/2008/11/get-forestps1.html .EXAMPLE PS c:\foo> .\Get-Forest.ps1 You are connected to the Cookham.NET forest #> ## # Start of script ## # Get Forest name $forest = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest() # Display info "You are connected to the {0} forest" -f $forest.name
This blog contains PowerShell scripts, more PowerShell scripts and still more PowerShell scripts. Occasionally you may see some organisational posts.
Friday 28 November 2008
Get-Forest.ps1
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment