Solved

Change contact information from Active Directory from all users by query

Posted on 2011-03-09
1
431 Views
Last Modified: 2012-05-11
How can I export a user's list and contact information from Active Directory on a csv file and/ or run a query that help me change the username and email address from a list of users on Active Directory.
Let's say I have 500 users I need to make that change over those 2 fields mentioned above, is there any query that help me to do it automatically by parameters, instead of going one by one ?
Any help will be appreciated.
Thank you.
0
Comment
Question by:petrobraspai
1 Comment
 
LVL 63

Accepted Solution

by:
SysExpert earned 500 total points
ID: 35090016

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/2003_Server/Q_21439433.html
LDIFDE import/export for a Dummy

for deletion of users from a list
Try this script.It was given to me by Farhan and its a great one...

:: ===============
:: READ THIS FIRST
:: ===============
:: * This script require "UserIDs.txt" file on C: drive root from where it will pick computer names.
:: * Successful run will generate "DisableUserRpt.txt" file on C: drive root.
:: * Copy and paste following script in notepad and save it with any name having .cmd extension.
:: *** SCRIPT START ***

@Echo Off
SETLOCAL EnableDelayedExpansion
IF NOT EXIST C:\UserIDs.txt Goto ShowErr
FOR %%R IN (UserIDs.txt) Do IF %%~zR EQU 0 Goto ShowErr
IF EXIST C:\DisableUserRpt.txt DEL /F /Q C:\DisableUserRpt.txt

FOR /F %%c IN ('Type C:\UserIDs.txt') Do (
    Echo Processing: %%c
    DSQuery User -samid %%c | Find /I "CN=" >NUL
    IF NOT ErrorLevel 1 (
            DSQuery User -samid %%c |DSMod User -disabled yes >>C:\DisableUserRpt.txt
      ) ELSE (Echo %%c: ERROR - User NOT Found in AD. >>C:\DisableUserRpt.txt)
)
Goto EndScript
:ShowErr
Echo "C:\UserIDs.txt" file does not exist or file is empty!
:EndScript
ENDLOCAL
:: *** SCRIPT END ***

Hi!

You can use CSVDE or LDIFDE, both tools have some limitations, I prefer to use LDIFDE:
http://support.microsoft.com/kb/555634
http://support.microsoft.com/kb/327620
Try here http://www.computerperformance.co.uk/vbscript/vbscript_user_spreadsheet.htm

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/Windows_2003_Active_Directory/Q_22927314.html



I hope this helps !
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Resolve DNS query failed errors for Exchange
This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

809 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