"primoz88" <> wrote in message
news

...
>
> Hi all,
>
>
>
> I am using a script posted in the other thread for Mass Group Creation
> in AD.
>
> The script is importing data from excel sheet (name,
> description,notes).
>
>
>
> Very important for me is to also organize the script to import
> ManagedBy information from the Excel sheet.
>
> I would like to put user name in another column, which will be
> automatically added to group "Managed By" tab.
>
>
>
> Can anyone advise how to generally update Group's "Managed By" tab?
>
> I will try to modify/implemt the code lateron to my script and I will
> post it?
>
>
The value assigned to the managedBy attribute must be the full Distinguished
Name of a user. An example might be similar to:
cn=Jim Smith,ou=Sales,ou=West,dc=MyDomain,dc=com
If you add the Distinguished Name to column 5 of the spreadsheet, you can
use this statement in the loop that reads rows of the spreadsheet:
strManagedBy = objSheet.Cells(intRow, 5).Value & ""
I append an empty string to the value in case there is no value in the cell
of the spreadsheet. All other values in the spreadsheet are required, but
this one is not (it can be blank). Then when values are assigned to the
attributes of the new group object, add these statements:
If (strManagedBy <> "") Then
objGroup.Put, "managedBy", strManagedBy
End If
Again, I account for the possibility that there is no value. An error is
raised if you attempt to assign either a blank or null. Finally, since the
script uses Option Explicit, you also need to add a statement near the
beginning to declare the new variable:
Dim strManagedBy
I hope this helps.
--
Richard Mueller
MVP Directory Services
Hilltop Lab -
http://www.rlmueller.net
--