Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Enable multiple mail enabled groups "From Authenticated Users Only" script

Posted on 2009-04-13
Medium Priority
Last Modified: 2012-06-27

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:

I open a cmd prompt and type cscript c:"script.vbs" and nothing happens .

Help please,

Option Explicit
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"
             objGroup.Put "msExchRequireAuthtoSendTo", True
            If Err.Number <> 0 Then
                  WScript.Echo strGroupName & ": Failed; " & Err.Description
            End If
            Set objGroup = Nothing
      End If
      On Error Goto 0
Set objRecordSet = Nothing
Set objCommand = Nothing
Set objConnection = Nothing

Open in new window

Question by:Tacobell2000
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 24131878
What version of Exchange are you running? If you are running '07 this is easier through a Powershell script.

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 -RequireSenderAuthenticationEnabled $True}

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:

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 {$_.RequireSenderAuthenticationEnabled}

Once you've got these set, let me know and we'll work through the accepted mail.

Accepted Solution

dud386 earned 2000 total points
ID: 24131900
I made a mistake above, do not name the file "distroname.csv", name it "distro.csv" :-)

Author Comment

ID: 24132162
mmm...I'm running Exchange 2003

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
On September 18, Experts Exchange launched the first installment of the Help Bell, a new feature for Premium Members, Team Accounts, and Qualified Experts. The Help Bell will serve as an additional tool to help teams increase question visibility.
In this video we show how to create a Shared Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Sha…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
Suggested Courses

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question