Visualiser la répartition des rôles FSMO d’un domaine Active Directory en VBScript

Ce script permet d’afficher les rôles FSMO du domaine depuis lequel il est exécuté.

Le meilleur VPN au monde
Set objRootDSE = GetObject("LDAP://rootDSE")

Set objSchema = GetObject _
("LDAP://" & objRootDSE.Get("schemaNamingContext"))
strSchemaMaster = objSchema.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strSchemaMaster)
Set objComputer = GetObject(objNtds.Parent)
strList = "Forest-wide Schema Master FSMO: " & objComputer.Name & vbCr

Set objPartitions = GetObject("LDAP://CN=Partitions," & _
objRootDSE.Get("configurationNamingContext"))
strDomainNamingMaster = objPartitions.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strDomainNamingMaster)
Set objComputer = GetObject(objNtds.Parent)
strList = strList & "Forest-wide Domain Naming Master FSMO: " & objComputer.Name & vbCr

Set objDomain = GetObject("LDAP://" & objRootDSE.Get("defaultNamingContext"))
strPdcEmulator = objDomain.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strPdcEmulator)
Set objComputer = GetObject(objNtds.Parent)
strList = strList & "Domain's PDC Emulator FSMO: " & objComputer.Name & vbCr

Set objRidManager = GetObject("LDAP://CN=RID Manager$,CN=System," & _
objRootDSE.Get("defaultNamingContext"))
strRidMaster = objRidManager.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strRidMaster)
Set objComputer = GetObject(objNtds.Parent)
strList = strList & "Domain's RID Master FSMO: " & objComputer.Name & vbCr

Set objInfrastructure = GetObject("LDAP://CN=Infrastructure," & _
objRootDSE.Get("defaultNamingContext"))
strInfrastructureMaster = objInfrastructure.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strInfrastructureMaster)
Set objComputer = GetObject(objNtds.Parent)
strList = strList & "Domain's Infrastructure Master FSMO: " & objComputer.Name & vbCr

WSCript.Echo strList
Ce code est correctement formaté.
Vous pouvez directement le COPIER / COLLER dans un fichier VBS.

Laisser un commentaire