此脚本可以在Microsoft Exchange Server中列出Exchange的组织名称。
On Error Resume Next
Set ObjRoot = GetObject("LDAP://RootDSE")
strConfigNC = ObjRoot.Get("configurationNamingContext")
Set colExchangeContainer = GetObject _
("LDAP://CN=Microsoft Exchange,CN=Services," & strConfigNC)
If Err = 0 Then
For Each objExchangeOrg In colExchangeContainer
If (objExchangeOrg.Class = "msExchOrganizationContainer") Then
Wscript.Echo "Exchange Organization name: " & _
objExchangeOrg.Get("CN")
End If
Next
Else
WScript.Echo "Exchange not installed."
End If