切换到宽版
  • 5561阅读
  • 0回复

[求助]使用脚本配置发送和接收信息大小 [复制链接]

上一主题 下一主题
 
只看楼主 倒序阅读 0楼  发表于: 2011-03-10
— 本帖被 YOYO 从 Exchange 脚本中心 移动到本区(2015-06-25) —
  • 脚本环境:Visual Basic
  • 适合版本:Exchange 2003
  • 适用平台:
  • 脚本作用:使用些脚本可以为Exchange配置发送和接收信息大小。
Option Explicit

'**************Items to be changed***********************************

    ' Change the value to set the base LDAP path
    Const sConfigPath = "ou=Users,ou=Asia Pacific,dc=contoso,dc=com"
    
    ' Change the value to set the Domain Controller name
    Const sADDC = "DCW2K3"
    
    ' Change the value to set the Exchange 2003 Server name
    Const sExchangeServer = "EX2K3"

'********************************************************************

Dim oFSO
Dim sOutputFile
Dim oOutputFile
Dim oConnAD
Dim oComAD
Dim oRSAD
Dim sADQuery
Dim oADUser
Dim HomeServer
Dim DName



'Create the File System and AD object references
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
Set oConnAD = WScript.CreateObject("ADODB.Connection")

'Create output file to see what objects were modified.
sOutputFile = "MsgLimit.txt"
Set oOutputFile = oFSO.OpenTextFile(sOutputFile, 8, True)

'Define and open the ADO provider for connecting to AD
oConnAD.Provider = "ADsDSOObject"
oConnAD.Open "ADs Provider"

'Build the AD query to find only users and groups that are mailbox-enabled
'then return the values of the properties defined at the tail end of the query string.
sADQuery = "<LDAP://" & sADDC & "/" & sConfigPath & ">;(&(objectClass=user)(objectCategory=person)(mailNickname=*))" &

";adspath,distinguishedName,displayName,msExchHomeServerName,delivContLength,submissionContLength;subtree"

'Set the connection properties for the AD query
Set oComAD = WScript.CreateObject("ADODB.Command")
oComAD.ActiveConnection = oConnAD
oComAD.Properties("Page Size") = 500
oComAD.CommandText = sADQuery

'Execute the AD query
Set oRSAD = WScript.CreateObject("ADODB.Recordset")
Set oRSAD = oComAD.Execute

'Loop through each AD users found
While Not oRSAD.EOF
        Dname = oRSAD.Fields("displayName")
        HomeServer = oRSAD.Fields("msExchHomeServerName")
        If HomeServer <> "" Then
            HomeServer = Mid(HomeServer,InStrRev(HomeServer, "=")+1)
        End If
        If HomeServer = sExchangeServer Then
            Set oADUser = GetObject(oRSAD.Fields(0).Value)
            oADUser.delivContLength = 8192
            oADUser.submissionContLength = 8192
            oADUser.SetInfo
            Wscript.Echo DName & vbTab & HomeServer & vbTab & oRSAD.Fields("delivContLength") & vbTab &        

        oRSAD.Fields("submissionContLength")
            oOutputFile.WriteLine DName & vbTab & HomeServer & vbTab & oRSAD.Fields("delivContLength") & vbTab &    

            oRSAD.Fields("submissionContLength")
        End If



oRSAD.MoveNext
Wend

'Clean up.
oOutputFile.Close
oRSAD.Close
oConnAD.Close
Set oRSAD = Nothing
Set oComAD = Nothing
Set oConnAD = Nothing
分享到
快速回复
限60 字节
 
上一个 下一个