We help IT Professionals succeed at work.

Script to update "Street" on users in AD

Hi guys.

We are switching to a new address and I therefore want to update the "Street" field on my users in AD. I don't want to do this by hand but with a script.

Can you please help me with this? I have no experience with vbs.

I want to update all users in the ou:Employees,ou:DK,ou:test. And the new value for "Street" should be "teststreet".

Thank you all.
Comment
Watch Question

Premkumar YogeswaranSr. Analyst - System Administrator

Commented:
HI

Check this to modify the street

dsquery user ou=Employees,ou=DK,ou=test,dc=india,dc=com -limit 0 | dsmod user -street test street

Let me know if you have any issue

Cheers,
Prem
dsquery user ou=Employees,ou=DK,ou=test,dc=india,dc=com -limit 0 | dsmod user -street test street

Open in new window

Premkumar YogeswaranSr. Analyst - System Administrator

Commented:
Copy paste the query which i posted above in command prompt

cheers,
Prem

Author

Commented:
Thank you.

I get this error:

dsmod failed:`-street' is an unknown parameter.

I am running it on my Win 2003 DC.
Street is not a valid switch that can be used with DSquery/DSmod.

I woulld suggest you download and use admodify to change the value. I know you mentioned you wanted a script but ADmodify has a nice gui that allows you to change multiple aspects of an account.

http://admodify.codeplex.com/

Very simple to use select your ou, select all of your users, then it will bring up a screen that looks like active directory users and computers. Simply enter your street address there and hit modify it will change it for all of them.
This is a screenshot of the tool in action.
1.jpg
Premkumar YogeswaranSr. Analyst - System Administrator

Commented:
HI,

You can do the same with the saved queries.

create a saved queiries in ADUC by following the link below

http://www.windowsecurity.com/articles/Using-Saved-Queries.html

@ Query Root point the OU

@ Define Query -> Common queries -> User tab -> Name start with *

click ok

so it will display all the users in that OU

Select all users go to address tab and update the street

Let me know if you any issue

the link above will guide u step by step

Also refer:

http://www.petri.co.il/saved_queries_in_windows_2003_dsa.htm

Good Luck

Cheers,
Prem

Author

Commented:
This is a great tool!