четверг, 7 августа 2008 г.

основная информация о AD DS

Иногда бывает необходимо быстро просмотреть информацию о каталоге AD.. н-р.: версию схемы.. режим и т.д...

'--===============================================

'Author - efimov (ge][) gennady
'date last change: 2008-04-23

set rootDSE = GetObject("LDAP://RootDSE")
set schema_ = GetObject("LDAP://" + rootDSE.Get("dnsHostName") + "/" + rootDSE.Get("schemaNamingContext"))
WSCript.Echo ">>> currentTime: " + rootDSE.Get("currentTime")
WSCript.Echo ">>> subschemaSubentry: " + rootDSE.Get("subschemaSubentry")
WSCript.Echo ">>> dsServiceName: " + rootDSE.Get("dsServiceName")
WSCript.Echo ">>> namingContexts: "
Dim namingcontext
For Each Item In rootDSE.Get("namingContexts")
WSCript.Echo " " + Item
Next
WSCript.Echo ">>> defaultNamingContext: " + rootDSE.Get("defaultNamingContext")
WSCript.Echo ">>> schemaNamingContext: " + rootDSE.Get("schemaNamingContext")
WSCript.Echo ">>> rootDomainNamingContext: " + rootDSE.Get("rootDomainNamingContext")
WSCript.Echo ">>> supportedControl: "
For Each Item In rootDSE.Get("supportedControl")
WSCript.Echo " "+ Item
Next
WSCript.Echo ">>> supportedLDAPVersion: "
For Each Item In rootDSE.Get("supportedLDAPVersion")
WSCript.Echo " " + Item
Next
WSCript.Echo ">>> supportedLDAPPolicies: "
For Each Item In rootDSE.Get("supportedLDAPPolicies")
WSCript.Echo " "+Item
Next
WSCript.Echo ">>> highestCommittedUSN: " + rootDSE.Get("highestCommittedUSN")
WSCript.Echo ">>> supportedSASLMechanisms: "
For Each Item In rootDSE.Get("supportedSASLMechanisms")
WSCript.Echo " " + Item
Next
WSCript.Echo ">>> dnsHostName: " + rootDSE.Get("dnsHostName")
WSCript.Echo ">>> ldapServiceName: " + rootDSE.Get("ldapServiceName")
WSCript.Echo ">>> serverName: " + rootDSE.Get("serverName")
WSCript.Echo ">>> supportedCapabilities: "
For Each Item In rootDSE.Get("supportedCapabilities")
WSCript.Echo " " + Item
Next
WSCript.Echo ">>> isSynchronized: " + rootDSE.Get("isSynchronized")
WSCript.Echo ">>> isGlobalCatalogReady: " + rootDSE.Get("isGlobalCatalogReady")
WSCript.Echo ">>> domainFunctionality: "
Select Case rootDSE.Get("domainFunctionality")
Case 0
WSCript.Echo " "+rootDSE.Get("domainFunctionality") + " - (Windows 2000 Domain Mode)"
Case 1
WSCript.Echo " "+rootDSE.Get("domainFunctionality") +" - (Windows Server 2003 Interim Domain Mode)"
Case 2
WSCript.Echo " "+rootDSE.Get("domainFunctionality") +" - (Windows Server 2003 Domain Mode)"
Case 3
WSCript.Echo " "+rootDSE.Get("domainFunctionality") +" - (Windows Server 2008 Domain Mode)"
Case Else
WSCript.Echo " "+rootDSE.Get("domainFunctionality") +" - (Unknown Domain Mode)"
End Select
WSCript.Echo ">>> forestFunctionality: "
Select Case rootDSE.Get("forestFunctionality")
Case 0
WSCript.Echo " " + rootDSE.Get("forestFunctionality") + " - (Windows 2000 Forest Mode)"
Case 1
WSCript.Echo " " + rootDSE.Get("forestFunctionality") + " - (Windows Server 2003 Interim Forest Mode)"
Case 2
WSCript.Echo " " + rootDSE.Get("forestFunctionality") + " - (Windows Server 2003 Forest Mode)"
Case 3
WSCript.Echo " " + rootDSE.Get("forestFunctionality") + " - (Windows Server 2008 Forest Mode)"
Case Else
WSCript.Echo " " + rootDSE.Get("forestFunctionality") + " - (Unknown Forest Mode)"
End Select
WSCript.Echo ">>> domainControllerFunctionality: "
Select Case rootDSE.Get("domainControllerFunctionality")
Case 0
WSCript.Echo " " + rootDSE.Get("domainControllerFunctionality") + " - (Windows 2000 Mode)"
Case 2
WSCript.Echo " " + rootDSE.Get("domainControllerFunctionality") + " - (Windows Server 2003 Mode)"
Case 3
WSCript.Echo " " + rootDSE.Get("domainControllerFunctionality") + " - (Windows Server 2008 Mode)"
Case Else
WSCript.Echo " " + rootDSE.Get("domainControllerFunctionality") + " - (Unknown DC Mode)"
End Select
WSCript.Echo ">>> schemaVersion: "
Select Case schema_.Get("ObjectVersion")
Case 13
WSCript.Echo " " + CStr(schema_.Get("ObjectVersion")) + " - (Windows 2000 Server)"
Case 30
WSCript.Echo " " + CStr(schema_.Get("ObjectVersion")) + " - (Windows Server 2003)"
Case 31
WSCript.Echo " " + CStr(schema_.Get("ObjectVersion")) + " - (Windows Server 2003 R2)"
Case 44
WSCript.Echo " " + CStr(schema_.Get("ObjectVersion")) + " - (Windows Server 2008 (AD/DS))"
End Select
'--===============================================


Пример запуска:
файл ADMainInfo.vbs
команда: cscript.exe ADMainInfo.vbs




Комментариев нет: