Solved

Change contact information from Active Directory from all users by query

Posted on 2011-03-09
1
435 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
LDAP Setup 6 65
Compatibility view list registry key 1 47
Receiving error when  installing Service Pack 3 on Microsoft Exchange 2010 3 54
Run powershell against OU 7 79
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
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 …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

710 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