- # Get-FSMOHolders.ps1
- # Gets the names of the systems holding the 5 FSMO holders
- # Runs on a domain-joined machine
- # Thomas Lee - tfl@psp.co.uk
- # Get host,forest and domain details
- $Hostname = hostname
- $forest = [DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()
- $domain = [DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
- #Display FSMOs, forest wide first
- "For Host {0}" -f $hostname
- "In Forest {0}, forest masters are: " -f $for.name
- "Schema master : {0}" -f $forest.SchemaRoleOwner.Name
- "Domain Master : {0}" -f $forest.NamingRoleOwner.Name
- ""
- # Current domain
- "In domain {0}, domain masters are:" -f $dom.Name
- "PDC Master : {0}" -f $domain.PdcRoleOwner
- "Infrastructure Master : {0}" -f $domain.InfrastructureRoleOwner
- "RID Master : {0}" -f $domain.RidRoleOwner
This code produces the following output:
PS C:\foo> .\Get-FSMOHolders.ps1
For Host Cookham8
In Forest cookham.net, forest masters are:
Schema master : Cookham1.cookham.net
Domain Master : Cookham1.cookham.netIn domain cookham.net, domain masters are:
PDC Master : Cookham1.cookham.net
Infrastructure Master : Cookham1.cookham.net
RID Master : Cookham1.cookham.net
No comments:
Post a Comment