-
August 7th, 2012, 05:12 PM
#1
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
-
August 8th, 2012, 02:21 AM
#2
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
-
August 8th, 2012, 04:25 PM
#3
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
-
By jm459 in forum Tech Humor
Replies: 1
Last Post: April 14th, 2004, 01:41 PM
-
By Fasheezy in forum Hardware
Replies: 5
Last Post: February 5th, 2004, 04:25 PM
-
By smirc in forum AntiOnline's General Chit Chat
Replies: 6
Last Post: May 13th, 2002, 04:35 PM
-
By smirc in forum AntiOnline's General Chit Chat
Replies: 3
Last Post: May 13th, 2002, 03:24 AM
-
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
-
Forum Rules
|
|