|
|
|||||||
Hi, I've searched the board and can find lots of adding users to groups, but not groups to groups... I have some script to view the local users on a network pc, then I can select a domain user and add them in as a local admin. This works fine. However as soon as I add domain groups as well as users to the listview and then select an object to add to the local machine, the scripts bombs out. Here is the script to populate the list Code: $domain=@ldomain and here is the adding bit : Code: Function AddUser() ($group is defined further up in the script as getobject("WinNT://"+$target+"/Administrators")) Basically, if the domain groups are not included in the list view, the script works, when they are the adding function bombs. Any help gratefully received! Thanks. |
||||||||
|
|
|||||||
you say bombs. I ask what that means. you have error checking there and I quess it at least fails on: $group.Add("WinNT://"+ @ldomain + "/" + $usertoadd) so, what does mean bombing? |
||||||||
|
|
|||||||
Sorry, bombing means it crashes. It just beeps at me and stops. The command you mention ($group.Add("WinNT://"+ @ldomain + "/" + $usertoadd)) works fine if the selection list contains users only. |
||||||||
|
|
|||||||
k, so I thought it would mean that but your script is full of error checking... add some, what is crucial is to know where does it crash and what are the causes. what-goes-in-what-comes-out of the crash is must. thanks. |
||||||||
|
|
|||||||
how about this udf GroupAdd() example... Code:
|
||||||||
|
|
|||||||
Yeah, that does the job but I still can't have it add when I select a group from a list, but this is a workable solution. Thanks. |
||||||||
|
|
|||||||
Quote: What do you mean by that exactly? Here is another example, not in a UDF (Function) format, but should give you a little more of an idea of how it works. But I assume that Bryce's UDF does work too, but maybe we need to see how you're calling it and using it. Can you post your code here so we can see how you're using it? Code: Dim $Computer,$AccountToAdd,$GroupToAdd,$GroupToAddTo,$Domain,$Group,$User |
||||||||
|
|
|||||||
Sorry, I'm got my forums a bit muddled here. The list bit comes from KixForms. I have a list of users, use the FocusItems.Subitems.Text handle so as I can pick a user and click add. Which works, but as soon as I select a group and click add the script crashes. But the solution above is fine for me. Thanks muchly! |
||||||||
|
|
|||||||
...and sorry, I forgot to login |