Solved

Change contact information from Active Directory from all users by query

Posted on 2011-03-09
1
426 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
Comment Utility

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

Suggested Solutions

This is my first article in EE and english is not my mother tongue so any comments you have or any corrections you would like to make, please feel free to speak up :) For those of you working with AD, you already are very familiar with the classi…
In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
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 tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

762 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

9 Experts available now in Live!

Get 1:1 Help Now