Quantcast
Viewing all articles
Browse latest Browse all 31638

AD Notes Field - Pls Help with this Script

OptionExplicit

Dim strNotes, strFile, objFSO, objFile, strDN, objGroup

Const ForReading

' Notes to be added to all groups.
strNotes = "This is a test,"& vbCrLf &"This is only a test."

' Specify the file of group DN's.
strFile = c:\Scripts\Groups.txt

' Open the file for reading.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFile, ForReading)

' Read each line of the file
DoUntil objFile.AtEndOfStream
    strDN = Trim(objFile.ReadLine)
    ' Skip blank lines.
    If (strDN <> "") Then
        ' Bind to group.
        Set objGroup = GetObject("LDAP://"& strDN)

        ' Assign value to the info attribute (Notes).
        objGroup.info = strNotes

        ' Save change in Active Directory.
        objGroup.SetInfo
    EndIf
Loop

' Clean up.
objFile.Close

This script gives error : Error at Line 5

Character 17

Error : expected "="

Can somebody please check and help out..



Viewing all articles
Browse latest Browse all 31638

Trending Articles