Add list of computers to domain group

this is probably pretty simple, but I've got this text file containing a bunch of computernames that I want to add as members of a certain AD Group. Thing is, I don't know the CN or full path of the computer names, because the computers may lie on three different OUs in the Domain structure.

So, I the code I've got so far is this (strLine is the short computername):

contents = textFile.ReadAll
arrLines = Split(contents,vbCrLf)

For Each strLine in arrLines
  AddToGroup strLine
next

textFile.Close

And the function 'AddToGroup' isn't created yet. Basically, this needs to take the argument (strLine) and look up the computername to get the full CN Name. And then add it to the AD group.

This is probably pretty basic, but my head is kinda full right now.. :(

Answers


Nevermind, got it to work myself by finding out the CN prior to the other script. Like this:

Set ADSys = CreateObject("ADSystemInfo")
FullCN = ADSys.ComputerName

Need Your Help

Can the MvcSiteMap work like the one in WebForms

asp.net-mvc authorization asp.net-mvc-sitemap

In webforms if a path is not accesable for a certain user, it will be hidden, can this be done with the MvcSiteMap?

Are some keyboards more loquacious than others?

c# winforms arrow-keys beep keyeventargs

The lead developer says that when he uses my app, his keyboard beeps when he moves between TextBoxes on the TableLayoutPanel via the directional arrow keys.