다음을 통해 공유


PowerShell, FSMOs and Netdom

I like any excuse to try and match the functionality of an executable with PowerShell.

This week I decided to take a pop at:

netdom query fsmo

This lists the FSMO role holders for the current domain and forest. Now, for some reason, there's not a cmdlet for listing out the FSMOs. In fact, getting the information involves running both the Get-ADForest and Get-ADDomain cmdlets and then filtering out the results. This mild inconvenience means that I always turn to the netdom command for FSMO information.

 

Enough Already!

To stop myself using a legacy executable and to further promote the glory of PowerShell, I wrote this little function to mimic netdom.

Function Get-ADFsmo {

$Forest = Get-ADForest; $Domain = Get-ADDomain

$FSMOs = @"

`t

=====

FSMOs

=====

Schema Master: $($Forest.SchemaMaster)

Domain Naming Master: $($Forest.DomainNamingMaster)

PDC Emulator: $($Domain.PDCEmulator)

Infrastructure Master: $($Domain.InfrastructureMaster)

RID Master: $($Domain.RIDMaster)

`t

"@

$FSMOs

}

It even outputs text rather than server objects - just like netdom! The here string allows me to construct the text output. I could (and should) use a hash table or PS Custom Object, but the here string seemed to be more in the spirit of netdom.

Toodle-Pip!

Comments

  • Anonymous
    July 30, 2015
    Good one.
  • Anonymous
    August 31, 2015
    Recent Releases and Announcements

    SQL 2016 CTP 2.3 has been released

    http://www.microsoft