Je@nb Modérateur Kindly give dime | exchange 2007 ?
Tu pipes ta liste d'utilisateur en powershell à la commande Set-CASMailbox http://technet.microsoft.com/fr-fr [...] 25264.aspx
Pour exchange 2003 va falloir faire mumuse avec l'attribut protocolSettings de l'object.
Tu as ce code de http://www.experts-exchange.com/Pr [...] 15593.html que tu peux utiliser
Code :
- '==================
- strInputFile = "Users_To_Disable_OWA.txt"
- Const intForReading = 1
- Set objFSO = CreateObject("Scripting.FileSystemObject" )
- Set objNetwork = CreateObject("WScript.Network" )
- Const ADS_PROPERTY_CLEAR = 1
- Const ADS_PROPERTY_UPDATE = 2
- Const ADS_PROPERTY_APPEND = 3
- Const ADS_PROPERTY_DELETE = 4
- Const conExInetOWAoff = "HTTP§0§1§§§§§§"
- Const conExInetOWAon = "HTTP§1§1§§§§§§"
- Set objInputFile = objFSO.OpenTextFile(strInputFile, intForReading, False)
- While Not objInputFile.AtEndOfStream
- strLogin = objInputFile.ReadLine
- strNTName = objNetwork.UserDomain & "\" & strLogin
- strObjectType = "user" ' Can be "user", "group", or "computer"
- strInputFormat = "NTLoginName" ' Can be "NTLoginName" or "DisplayName"
- strUserDN = Get_DistinguishedName_From_AD(strNTName, strObjectType, strIntputFormat)
-
- If strUserDN <> "ERROR" Then
- 'MsgBox "adsPath of " & strNTName & ":" & VbCrLf & "LDAP://" & strUserDN
- Set objUser = GetObject("LDAP://" & strUserDN)
- On Error Resume Next
- arrSettings = objUser.GetEx("protocolSettings" )
- strSettings = ""
- If Err.Number = 0 Then
- Err.Clear
- For Each protocolSettings In objSettings
- If Err.Number <> 0 Then Exit For
- If Left(protocolSettings, 4) <> "HTTP" Then
- ' Keep anything other than a HTTP Protocol
- If strSettings = "" Then
- strSettings = protocolSettings
- Else
- strSettings = strSettings & ";" & protocolSettings
- End If
- End If
- Next
- Err.Clear
- On Error GoTo 0
- Else
- Err.Clear
- On Error GoTo 0
- 'MsgBox "Cannot retrieve protocolSettings"
- End If
- If strSettings = "" Then
- strSettings = conExInetOWAoff
- Else
- strSettings = strSettings & ";" & conExInetOWAoff
- End If
- On Error Resume Next
- ' Clear the settings before re-applying them
- objUser.PutEx ADS_PROPERTY_DELETE, "protocolSettings", 0
- objUser.SetInfo
- Err.Clear
- On Error GoTo 0
- objUser.PutEx ADS_PROPERTY_APPEND, "protocolSettings", Split(strSettings, ";" )
- objUser.SetInfo
- Else
- MsgBox "There was an error returning the DistinguishedName attribute of " & strNTName
- End If
- Wend
- objInputFile.Close
- Set objInputFile = Nothing
- MsgBox "Done"
- Function Get_DistinguishedName_From_AD(strName, strObjectType, strInputFormat)
- ' Source: http://www.rlmueller.net/NameTrans [...] eTranslate
- ' Constants for the NameTranslate object.
- ' INIT Method Parameters
- ' To search a specific domain that is not the local one
- Const ADS_NAME_INITTYPE_DOMAIN = 1 ' Use objTrans.Init ADS_NAME_INITTYPE_DOMAIN, "MyDomain.com"
- ' To search a specific domain controller in the local domain
- Const ADS_NAME_INITTYPE_SERVER = 2 ' Use objTrans.Init ADS_NAME_INITTYPE_SERVER, "MyServer"
- ' To search through local domain - should be mainly used
- Const ADS_NAME_INITTYPE_GC = 3 ' Use objTrans.Init ADS_NAME_INIITTYPE_GC, ""
-
- If LCase(strObjectType) = "computer" Then
- If Right(strName, 1) <> "$" Then strName = strName & "$"
- End If
-
- ' SET and GET Method Parameters
- Const ADS_NAME_TYPE_1779 = 1
- Const ADS_NAME_TYPE_CANONICAL = 2
- Const ADS_NAME_TYPE_NT4 = 3
- Const ADS_NAME_TYPE_DISPLAY = 4
- Const ADS_NAME_TYPE_DOMAIN_SIMPLE = 5
- Const ADS_NAME_TYPE_ENTERPRISE_SIMPLE = 6
- Const ADS_NAME_TYPE_GUID = 7
- Const ADS_NAME_TYPE_UNKNOWN = 8
- Const ADS_NAME_TYPE_USER_PRINCIPAL_NAME = 9
- Const ADS_NAME_TYPE_CANONICAL_EX = 10
- Const ADS_NAME_TYPE_SERVICE_PRINCIPAL_NAME = 11
- Const ADS_NAME_TYPE_SID_OR_SID_HISTORY_NAME = 12
-
- ' Use the NameTranslate object to convert the NT user name to the
- ' Distinguished Name required for the LDAP provider.
- Set objTrans = CreateObject("NameTranslate" )
-
- ' Initialize NameTranslate by locating the Global Catalog.
- objTrans.Init ADS_NAME_INITTYPE_GC, ""
- boolError = False
- If LCase(strInputFormat) = "displayname" Then
- ' Use the Set method to specify the Display Name of the object name.
- On Error Resume Next
- objTrans.Set ADS_NAME_TYPE_DISPLAY, strName
- If Err.Number <> 0 Then boolError = True
- On Error GoTo 0
- Else ' assume it is the NTName
- ' Use the Set method to specify the NT format of the object name.
- On Error Resume Next
- objTrans.Set ADS_NAME_TYPE_NT4, strName
- If Err.Number <> 0 Then boolError = True
- On Error GoTo 0
- End If
-
- If boolError = False Then
- ' Use the Get method to retrieve the RPC 1779 Distinguished Name.
- strUserDN = objTrans.Get(ADS_NAME_TYPE_1779)
- Else
- strUserDN = "ERROR"
- End If
-
- ' Escape any "/" characters with backslash escape character.
- ' All other characters that need to be escaped will be escaped.
- strUserDN = Replace(strUserDN, "/", "\/" )
-
- Get_DistinguishedName_From_AD = strUserDN
- End Function
- '==================
|
|