Tacobell2000
asked on
Enable multiple mail enabled groups "From Authenticated Users Only" script
Hello,
I'd like to enable all mail enabled security groups and Distribution lists in our company to only accept mail from "everyone" and "authenticated users only". I have 355 groups.
I found a script on EE and when I execute it nothing happens. I found this script here:
https://www.experts-exchange.com/questions/21974938/Editing-Multiple-Distribution-Groups-in-one-hit.html
I open a cmd prompt and type cscript c:"script.vbs" and nothing happens .
Help please,
Tacobell2000
I'd like to enable all mail enabled security groups and Distribution lists in our company to only accept mail from "everyone" and "authenticated users only". I have 355 groups.
I found a script on EE and when I execute it nothing happens. I found this script here:
https://www.experts-exchange.com/questions/21974938/Editing-Multiple-Distribution-Groups-in-one-hit.html
I open a cmd prompt and type cscript c:"script.vbs" and nothing happens .
Help please,
Tacobell2000
Option Explicit
Const ADS_SCOPE_SUBTREE = 2
Dim objConnection, objCommand, objRecordSet, objRootDSE, objGroup
Dim strGroupName
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
Set objRootDSE = GetObject("LDAP://RootDSE")
objCommand.CommandText = "SELECT name, aDSPath " &_
"FROM 'LDAP://" & objRootDSE.Get("defaultNamingContext") & "' WHERE objectClass='group'"
Set objRootDSE = Nothing
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 600
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
While Not objRecordSet.EOF
On Error Resume Next
strGroupName = objRecordSet.Fields("name")
If Left(strGroupName, 1) = "@" Then
Set objGroup = GetObject(objRecordSet.Fields("aDSPath"))
WScript.Echo strGroupName & ": Resetting msExchRequireAuthtoSendTo to True"
Err.Clear
objGroup.Put "msExchRequireAuthtoSendTo", True
objGroup.SetInfo
If Err.Number <> 0 Then
WScript.Echo strGroupName & ": Failed; " & Err.Description
End If
Set objGroup = Nothing
End If
On Error Goto 0
objRecordSet.MoveNext
Wend
objConnection.Close
Set objRecordSet = Nothing
Set objCommand = Nothing
Set objConnection = Nothing
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mmm...I'm running Exchange 2003
When the distribution list is created, it allows "everyone" to send and requires authentication- unless you have explicitly entered in emails.
To set authentication, for all, you would have to do this:
1. Create a notepad file named "distro.ps1" > edit it > paste this code in:
Import-CSV distro.csv | foreach {Set-DistributionGroup -Identity $_.distroname -RequireSenderAuthenticati
2. Create another notepad file named "distroname.csv" > edit it > type: "distroname" as the top line > for every line below that put each of the 355 distribution group's name.
It should look something like this:
distroname
sales
marketing
blah
blah
3. Save both of those files to the same directory
4. Open the Exchange Management Shell > navigate to the directory where the scripts are > type in: distro.ps1 > press Enter
This will run and should not give any errors. You can then check the groups that have it enabled by typing this into the shell: Get-DistributionGroup | Where-Object {$_.RequireSenderAuthentic
Once you've got these set, let me know and we'll work through the accepted mail.