?
Solved

This script does exactly what I need except for throwing up the OK button which  must be clicked for each user. Is there any way to disable that pop-up?

Posted on 2009-05-03
3
Medium Priority
?
263 Views
Last Modified: 2012-05-06
This script does exactly what I need except for throwing up the OK button which  must be clicked for each user in the OU. Is there any way to disable that pop-up? It would also be nice if this only stuffed user accounts and contacts but avoided adding OUs or other groups within the OU.
On Error Resume Next '<<< add this line to skip errors
Set objOU = GetObject("LDAP://OU=SomeOU,dc=domain,dc=local")
Set objGroup = GetObject("LDAP://CN=GroupNameOU=SomeOU,dc=domain,dc=local")
 
For Each objUser in objOU
    strUser=objuser.AdsPath
    objGroup.Add strUser
    msgbox "Added " & strUser
Next

Open in new window

0
Comment
Question by:hcca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
ValleyENT earned 2000 total points
ID: 24292381
I am assuming you are being prompted like 100 times with a msgbox, if this is correct then you simply need to remove the "msgbox "Added " & strUser" in your code. It will do as you need, but just wont notify you each time.
0
 
LVL 14

Expert Comment

by:Dhiraj Mutha
ID: 24292394
Try this and check it out.
On Error Resume Next '<<< add this line to skip errors
Set objOU = GetObject("LDAP://OU=SomeOU,dc=domain,dc=local")
Set objGroup = GetObject("LDAP://CN=GroupNameOU=SomeOU,dc=domain,dc=local")
 
For Each objUser in objOU
    strUser=objuser.AdsPath
    objGroup.Add strUser
    'msgbox "Added " & strUser
Next

Open in new window

0
 

Author Closing Comment

by:hcca
ID: 31577430
Thanks so much for the quick reply to what, as it turned out, was a simple question. Never-the-less, I won't have to be messing with that problem tomorrow morning when I actually implement this. Both answers were correct but you got there first. Thanks again.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Suggested Courses
Course of the Month14 days, 14 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question