VBscript - 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

devise overrule devise SessionController broke login

ruby-on-rails ruby-on-rails-3 controller devise override

I have extended the devise controller for sessions. To add some extra functionality when a user logs in. Now upon login, IF no username or password are entered I get error :

Compiler error 1: constructor contains more than 0 args

c# visual-studio-2010 compiler-errors xna-4.0

I am a beginner with C, C#, XNA, and I am trying to follow some tutorials online, but when I try to make a paddle object from a different class, I get the error that the constructor does not contai...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.