troubleshooting Question

Continued Question Re: Script... Chris! I'm back!

Avatar of Jay_Jay70
Jay_Jay70Flag for Australia asked on
Windows Server 2003
6 Comments1 Solution705 ViewsLast Modified:
Hey Mate,

in regards to that script you helped me with last week, i need to exempt just one group from it! Is there a way to do it? Group is say    @james

Here is the code you gave me

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

Thanks again!

Chris Dent
PowerShell Developer
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros