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.. :(
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