Question : Is there a DSMOD query to change the domain part (only) of an email address in AD?

Hi,
I'm looking for a DSMOD (or equivalent) query to change my domain name in the description attribute of AD. We have two domains, the email attribute is filtered by our Exchange server. I've got a command to copy the contents from email attribute to description attribute and now just need to amend the domain name here..
So, FirstName.Surname(to remain unchanged)@example.com(to change).
Been looking everywhere for this....thought it would be pretty straight forward. Hope I've explained myself ok.

Thanks.

Answer : Is there a DSMOD query to change the domain part (only) of an email address in AD?

Mea maxima culpa, I went too fast, and when one goes too fast, one might stumble...

I forgot one parameter : the user dn, otherwise, you can't make a working batch file.

So, let's start again :

- you need to export pairs : user_dn,email_addy. The separator can be whatever you like, I generally choose commas.

- step 2 doesn't change : bulk modify the email addy part.

- now you can write the batch file :

FOR /F "tokens=1-2 delims=," %%A IN (users.txt) DO dsmod %%A description %%B

tokens=1-2 indicates that 2 fields should be taken into account in each lilne
users.txt is the file you exported
%%A is the 1st token encountered in each line
%%B is the second token encountered in each line
description is the attribute you want to modify


Pretty sure about the .bat syntax, however, you may want to check the dsmod syntax itself, haven't done it for a while, and no access to my AD right now.
Random Solutions  
 
programming4us programming4us