FSMO Roles
GetFSMORoles();
function GetFSMORoles()
{
try
{
print( "FSMO Roles" );
print( "=====================================" );
var rootdse = GetObject( "LDAP://rootDSE" );
var DNC = rootdse.Get( "defaultNamingContext" );
var SNC = rootdse.Get( "schemaNamingContext" );
var CNC = rootdse.Get( "configurationNamingContext" );
var oschema = GetObject( "LDAP://" + SNC );
var sSchemaMaster = oschema.Get( "fSMORoleOwner" );
var oNTDS = GetObject( "LDAP://" + sSchemaMaster );
var oComp = GetObject( oNTDS.Parent );
print( "Schema Master : " + oComp.Name );
var oPart = GetObject( "LDAP://CN=Partitions," + CNC );
var sDomainNamingMaster = oPart.Get( "fSMORoleOwner" );
oNTDS = GetObject( "LDAP://" + sDomainNamingMaster );
oComp = GetObject( oNTDS.Parent );
print( "Domain Naming Master : " + oComp.Name );
var oDomain = GetObject( "LDAP://" + DNC );
var sPDCEm = oDomain.Get( "fSMORoleOwner" );
oNTDS = GetObject( "LDAP://" + sPDCEm );
oComp = GetObject( oNTDS.Parent );
print( "PDC Emulator : " + oComp.Name );
var oRID = GetObject( "LDAP://CN=RID Manager$,CN=System," + DNC );
var oRIDMaster = oRID.Get( "fSMORoleOwner" );
oNTDS = GetObject( "LDAP://" + oRIDMaster );
oComp = GetObject( oNTDS.Parent );
print( "RID Master : " + oComp.Name );
var oInfra = GetObject( "LDAP://CN=Infrastructure," + DNC );
var oInfraMaster = oInfra.Get( "fSMORoleOwner" );
oNTDS = GetObject( "LDAP://" + oInfraMaster );
oComp = GetObject( oNTDS.Parent );
print( "Infrastructure Master : " + oComp.Name );
}
catch( e )
{
print( "Error: " + e.description );
}
}
function print( msg )
{
WScript.Echo( msg );
}