[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

VBScript - Importing user account information into Active Directory not populating correctly.

Asked by pepsi_cola in Active Directory

Tags: vbscript, active, directory, user

I have purchased a book titled:  "Microsoft Vbscript Step by Step" that has a sample script to import multiple user accounts from a "csv" file.  My question is; why does the script create the account, but not populate the account with the other information?  For example, the account will get created.  But when you go to Active Directory, and right-click the account and view its properties, on the "General" tab, the information there is blank.  In the script it has all the information there that should be populated.  Why is it not populating?  Any help that anyone can give me will be greatly appreciated.

----------------------------------------------------------
Start of script
----------------------------------------------------------
On Error Resume Next
Dim objFSO,objTS
Dim objDom,objUser

Const FORREADING=1

strFile="newusers.csv"
'format of newusers.csv
'givenname,sn,password,telephonenumber,upnsuffix
'example:
'Jeff,Hicks,P@sswordJH,555-1234,@jdhitsolutions.com
'Don,Jones,$cr1pting@nsw3rs,555-1234,@scriptinganswers.com

Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objTS=objFSO.OpenTextFile(strFile,FORREADING)

Set objDom=GetObject("LDAP://OU=Consultants,DC=Company,DC=pri")

'open text file and process user data on each line
Do while objTS.AtEndofStream<>True
 rline=objTS.readline
 UserArray=Split(rline,",")

       strFirst=UserArray(0)
      strLast=UserArray(1)
      strUser=strFirst & " " & strLast
      strLogon=Left(strFirst,1)&strLast
      strUsername=LCASE(Left(strFirst,1)&strlast)
      strPass=UserArray(2)
      strPhone=UserArray(3)
      strUPN=strUserName & UserArray(4)

'Create user object
Set objUser=objDom.Create ("User","cn="&strUser)
objUser.Put "samAccountName",strUserName
objUser.SetInfo

'Now that user object is created, let's set some properties
objUser.Put "givenname",strFirst
objUser.Put "sn",strLast
objUser.Put "displayname",strFirst & " " & strLast
objUser.Put "UserPrincipalName",strUPN
objUser.Put "AccountDisabled",FALSE
objUser.Put "TelephoneNumber",strPhone
objUser.SetPassword(strPass)
objUser.SetInfo

Loop

objTS.Close

WScript.Quit
----------------------------------------------------------
End of script
----------------------------------------------------------
[+][-]06/14/07 09:51 AM, ID: 19285092Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Active Directory
Tags: vbscript, active, directory, user
Sign Up Now!
Solution Provided By: Chris-Dent
Participating Experts: 1
Solution Grade: A
 
[+][-]06/14/07 11:06 AM, ID: 19285690Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/14/07 11:08 AM, ID: 19285711Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/14/07 11:11 AM, ID: 19285728Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/14/07 11:46 AM, ID: 19285992Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/14/07 01:25 PM, ID: 19286842Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/14/07 02:04 PM, ID: 19287188Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81