Solved

Change contact information from Active Directory from all users by query

Posted on 2011-03-09
1
427 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

I know all systems administrator at some time or another has had to create a script to copy file from a server share to a desktop. Well now there is an easy way to do this in Group Policy. Using Group policy preferences is not hard. The first thing …
Introduction You may have a need to setup a group of users to allow local administrative access on workstations.  In a domain environment this can easily be achieved with Restricted Groups and Group Policies. This article will demonstrate how to…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now