VBS AD Question
Results 1 to 3 of 3

Thread: VBS AD Question

Hybrid View

  1. #1
    Gonzo District BOFH westin's Avatar
    Join Date
    Jan 2006
    Location
    SW MO
    Posts
    1,188

    VBS AD Question

    Hey folks,

    I am working on automating some of our account creation. Here is a snippet from the script I am using:

    Code:
    While Not tsInputFile.AtEndOfStream
    
      
      strLine = tsInputFile.ReadLine
      arrInput = Split(strLine, ",")
    
      Set objUser = objDomain.Create("user","cn=" & arrInput(1) & " " & arrInput(0))
      objUser.Put "givenName", arrInput(1)
      ObjUser.Put "sn", arrInput(0)
      ObjUser.Put "displayName", arrInput(1) & " " & arrInput(0)
      objUser.Put "sAMAccountName", arrInput(2)
      objUser.Put "userPrincipalName", arrInput(2) & "@***"
    Only problem is that once in a while, someone will send me a spreadsheet that has a few user accounts that have already been created, which causes an error that terminates the script.

    What I would like to do, is to tell it that if an account exists, to move on to the next line in the CSV file. I am guessing this should be fairly simple, but I am not sure of the syntax when dealing with AD to make this happen. Anyone have any experience with this? I have searched around, but haven't had much luck finding anything.

    Many thanks!
    \"Those of us that had been up all night were in no mood for coffee and donuts, we wanted strong drink.\"

    -HST

  2. #2
    Gonzo District BOFH westin's Avatar
    Join Date
    Jan 2006
    Location
    SW MO
    Posts
    1,188
    Nice! Sometimes simple is the best option. I will give it a shot.

    Thanks spec!
    \"Those of us that had been up all night were in no mood for coffee and donuts, we wanted strong drink.\"

    -HST

  3. #3
    Gonzo District BOFH westin's Avatar
    Join Date
    Jan 2006
    Location
    SW MO
    Posts
    1,188
    Worked like a charm. Thanks again.
    \"Those of us that had been up all night were in no mood for coffee and donuts, we wanted strong drink.\"

    -HST

Similar Threads

  1. Question Time
    By jm459 in forum Tech Humor
    Replies: 1
    Last Post: April 14th, 2004, 01:41 PM
  2. Maximum performance question
    By Fasheezy in forum Hardware
    Replies: 5
    Last Post: February 5th, 2004, 03:25 PM
  3. Test Your General Linux Knowledge
    By smirc in forum AntiOnline's General Chit Chat
    Replies: 6
    Last Post: May 13th, 2002, 04:35 PM
  4. Test Your Knowledge of Redhat?
    By smirc in forum AntiOnline's General Chit Chat
    Replies: 3
    Last Post: May 13th, 2002, 03:24 AM
  5. Question Bout AntiPoint Assignment
    By NetSyn in forum Site Feedback/Questions/Suggestions
    Replies: 15
    Last Post: May 8th, 2002, 01:45 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides