Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Modification

Status
Not open for further replies.

bidon15

MIS
Sep 20, 2003
107
US
Hi,
Does anyone know how would i do this?

We need to add employ ID# to one field in general tab and add department name on the Department field in the Organization tab on user property. We have roughly 1000 users. I would not like to manually do this for every user at a time. It would take years to finish this project. ;) Is there a way that i can automatically or use vbscript? If so, where can i find a simalar script to do this?

I know this tool from MS "ADMODIFY" to change in bulk but my goal is to set each user has their own employee ID and deparment name for their unique attribute.

Right now, our AD user and computers is a choas which had inheritted from NT 4.0 migration. Some users don't have first name or last name and other are missing field. I am planing to restructure OU and apply the GPO for each department. So now all users are in the default users container. I'd like to move them to the approviate OU, e.g HR ou will has all users belong to HR department and so on, but I don't know the best way to persue this goal. We will add the employee id and dept. name. for each user name, but 1000 users will take me years to complete this project.

YOur help or idea will be very appreciated.

Regards,
 
yes, you can do this with a script.

Here is the basics of what you need:

Code:
Const ADS_PROPERTY_APPEND = 3 

Set objUser = GetObject _
   ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 

objUser.PutEx ADS_PROPERTY_APPEND, _
  "otherHomePhone", Array("(425) 555-1113")

objUser.SetInfo

The problem that you are going to run into is identifying the users LDAP Path. Without standardization I see this as a very difficult task to perform.

Might be best to export all of your users and have the information entered into an Excel spreadsheet. You could then read from that spreadsheet in the script and push out your updates. Check out my FAQ in the VBSCRIPT forum for "Scripting for the Enterprise" for an example of how to read from Excel.

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
you can also check out my FAQ:
Some very handy LDAP queries for user administration faq329-5688

There is a function there to get the Distinguished Name when you have the SAMAccountname...

Hope this helps...

--------------------------------------
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs,
and the Universe trying to produce bigger and better idiots.
So far, the Universe is winning.
 
First of all, i'd like to thank you you both for your respond. I have used the csvde to exported and filtered by user and manipulated the data in excel(e.i adding the emply ID in the physicalDeliveryOfficeName culumn and adding the department name in the department column) just for a test for couple users to see if it works first. Now the second phrase is to import the input.csv.Here is an error:


C:\Documents and Settings\Administrator>csvde -i -f input.csv -j c:\
Connecting to "(null)"
Logging in as current user using SSPI
Importing directory from file "input.csv"
Loading entries.
Add error on line 2: Invalid Syntax
The server side error is "The parameter is incorrect."
0 entries modified successfully.
An error has occurred in the program

Any ideas???

Beside, i also like to ask you that those buildin accounts (e.i administrator, guest,SUPPORT_388945a0,krbtgt, and others)which i did not modify them in the excel, will they be changed or corrupted by any chances? when i import them.

YOur ideas and help are greatly appreciated!

Regards,
 
Why don't you post your entire script so we know what you are working with.

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Hi Markdmac,

Here is what i am trying to accomplish...
After i export the user object to the output.csv and i made some changes department name of each users and now i am trying to inport the input.csv file after i saved and named it input.csv file. Once i ran the "csvde -i -f input.csv -j c:\" command and i got these errors... That where the error came out.



Your idea and help are greatly appreciated
Regrad
 
I'd use an Excel spreadsheet and a combination of the code I posted with the LDAP queries k0b3 posted. You can also find information on using Excel in your scripts by following my examples in my FAQ in the vbscript forum, Scripting For the Enterprise.

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top