dsquery / dsmod active directory users

here's an easy 500 points for someone

i have about 200 users i need to modify the active directory attribute called "web page" from one thing to another.

many of these users need to have a completely unrelated site in there, and not changed, and are not part of specific OU's or groups

can i use any AD command-line things, that can say something like:
"look at all users, if their 'web page' is http://www.foo.com, change it to http://www.bar.com"  ?

for clarification:
200 users in "users" OU
180 of them need to change from foo to bar (as above)
20 of them need to stay exactly as they are and not change at all
LVL 24
B HAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This may be oversimplifying it but... What if you moved the 20 users to a different OU temporarily, Made the change to the remaining 180, them move the 20 back in?

B HAuthor Commented:
i could do that - but i dont really know who they are... i know their "web page" attribute is different though...  they might have www.blah.com, and shouldnt be changed

if i wanted to just run it across all users anyway, and see who complains, what would that command be?
Joseph DalyCommented:
I got it for you right here.

dsquery * -filter "(&(objectCategory=user)(wWWHomePage=www.testing.com*))" | dsmod user -webpg www.bar.com

You need to use an LDAP filter which will return all the users with a specific page and then change that.

Run this first to see what users you are GOING to change
dsquery * -filter "(&(objectCategory=user)(wWWHomePage=www.testing.com*))"

Then when your comfotable with that run the dsmod one

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Mike KlineCommented:
I'll test dsquery/mod but I like using adfind and admod too


adfind -b "DN of your OU"  -f "&(objectcategory=person)(objectclass=user)(wwwhomepage=http://www.foo.com)" -adcsv | admod "wwwhomepage::http://www.bar.com"

...and for those that may come across this question via bing/google there is also a free GUI tool that is good and that is admodify.net  http://admodify.codeplex.com/

in this case you could use the LDAP query to find the users.


Mike KlineCommented:
....looks like I won't have to test dsquery/dsmod,  thanks xxd
Joseph DalyCommented:
The only addition I could make to mine that you had in your ADfind example would be to optionally target an OU. Right now mine is looking everywhere for users with the webpage set.
B HAuthor Commented:
this worked almost perfectly, just had to add -limit 300 into it, it only wanted to do 100.

so the complete command was:

dsquery * -limit 300 -filter "(&(objectCategory=user)(wWWHomePage=www.testing.com*))"  | dsmod user -webpg www.bar.com
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Server OS

From novice to tech pro — start learning today.