Question

Locked

active directory scripting using vb

By donnie.picard@medisy ·
I have a need to change the description field of several active directory groups in a particalar ou. This is what I was able to come up with, but I am unable to test it.

Const ADS_PROPERTY_UPDATE = 2
Dim reader As StreamReader = _
New StreamReader(winDir & "\group_names.txt")
Try
Me.ListBox1.Items.Clear()
Do
group_name = Me.ListBox1.Items.Add(reader.ReadLine)


Set objGroup = GetObject _
("LDAP://cn=group_name,ou=R&D,dc=NA,dc=fabrikam,dc=com")

objGroup.PutEx ADS_PROPERTY_UPDATE, _
"description", Array("what you want it to say here")
objGroup.SetInfo

Loop Until reader.Peek = -1

Catch
Me.ListBox1.Items.Add("File is empty")

Finally
reader.Close()
End Try

Can anyone tell me if this would work? I have worked with visual basic. I took this code from these two sources and put them together
http://support.microsoft.com/kb/304427
http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Microsoft Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums