Announcement

Collapse
No announcement yet.

Not returning the Description for a group

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Not returning the Description for a group

    I have the following code which does not return a description for any groups in my Win2K3 R2 SP2 AD. Can anyone tell me why?
    Code:
    On Error Resume Next
    
    Const ADS_GROUP_TYPE_GLOBAL_GROUP = &h2
    Const ADS_GROUP_TYPE_LOCAL_GROUP = &h4
    Const ADS_GROUP_TYPE_UNIVERSAL_GROUP = &h8
    Const ADS_GROUP_TYPE_SECURITY_ENABLED = &h80000000
     
    Set objGroup = GetObject _
        ("LDAP://cn=gShr_TEN-SRVLN_Artwork_Change,ou=TEN-SRVLN,ou=Global Share Groups, " & _
        	"ou=SCL Groups,dc=scl,dc=signet,dc=com, dc=au")
    
    WScript.Echo "Name: " & objGroup.Name
    WScript.Echo "SAM Account Name: " & objGroup.SAMAccountName
    WScript.Echo "Mail: " & objGroup.Mail
    WScript.Echo "Notes: " & objGroup.Info
    
    intGroupType = objGroup.GroupType
     
    If intGroupType AND ADS_GROUP_TYPE_LOCAL_GROUP Then
        WScript.Echo "Group scope: Domain local"
    ElseIf intGroupType AND ADS_GROUP_TYPE_GLOBAL_GROUP Then
        WScript.Echo "Group scope: Global"
    ElseIf intGroupType AND ADS_GROUP_TYPE_UNIVERSAL_GROUP Then
        WScript.Echo "Group scope: Universal"
    Else
        WScript.Echo "Group scope: Unknown"
    End If
     
    If intGroupType AND ADS_GROUP_TYPE_SECURITY_ENABLED Then
        WScript.Echo "Group type: Security group"
    Else
        WScript.Echo "Group type: Distribution group"
    End If
     
    For Each strValue in objGroup.Description
        WScript.Echo "Description: " & strValue
    Next
    |
    +-- JDMils
    |
    +-- Regional Systems Engineer, DotNet programmer & Jack of all trades
    |

  • #2
    Re: Not returning the Description for a group

    Because "Description" is not a multivalued Attribute you can not loop through values like:
    Code:
    For Each strValue in objGroup.Description
        WScript.Echo "Description: " & strValue
    Next
    The "Description" contains a string value. Therefore replace the three lines with
    Code:
    WScript.Echo "Description: " & objGroup.Description
    \Rems

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment

    Working...
    X