- <#
- .SYNOPSIS
- Shows use of GetCurrentDomain to return information about the domain
- .DESCRIPTION
- Uses system.directoryservices.activedirectory.domain and GetCurrentDomain
- to return domain information
- .NOTES
- File Name : get-domain.ps1
- Author : Thomas Lee - tfl@psp.co.uk
- Requires : PowerShell V2 CTP3
- .LINK
- http://www.pshscripts.blogspot.com
- .EXAMPLE
- PS c:\foo> .\get-domain.ps1
- You are connected to the cookham.net domain
- Role Holders in this domain:
- PDC Role Holder : Cookham1.cookham.net
- RID Role Holder : Cookham1.cookham.net
- InfraM Role Holder : Cookham1.cookham.net
- #>
- ###
- # Start of script
- ###
- #Get Domain information
- $domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
- #Display information
- "You are connected to the {0} domain" -f $domain.name
- "Role Holders in this domain:"
- " PDC Role Holder : {0}" -f $domain.PdcRoleOwner
- " RID Role Holder : {0}" -f $domain.RIDRoleOwner
- " InfraM Role Holder : {0}" -f $domain.InfrastructureRoleOwner
- # End of script
Thursday, 1 January 2009
Get-Domain
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment