Solved

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

Posted on 2009-04-13
3
598 Views
Last Modified: 2012-06-27
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:
http://www.experts-exchange.com/Software/Server_Software/Email_Servers/Exchange/Q_21974938.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

Open in new window

0
Comment
Question by:Tacobell2000
  • 2
3 Comments
 
LVL 4

Expert Comment

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

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

Accepted Solution

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

Author Comment

by:Tacobell2000
ID: 24132162
mmm...I'm running Exchange 2003
0

Featured Post

The curse of the end user strikes again      

You’ve updated all your end user’s email signatures. Hooray! But guess what? They’re playing around with the HTML, adding stupid taglines and ruining the imagery. Find out how you can save your signatures from end users today.

Join & Write a Comment

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video discusses moving either the default database or any database to a new volume.

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now