Account Creation Script (not spam)
June 5, 2009 4:45 PM   RSS feed for this thread Subscribe

Simple need for autofilling a web page with a different set of variables each time. Assuming I have a CSV of the user accounts I need to create, how can I create or find a script that will let me create new accounts by entering the CSV info into set fields (name, email, password), submitting and then automaticaly proceeding onto the next user account? This is for Active Directory account creation on a website through a Citrix Client, totally legitimate, not spamming.
posted by BrodieShadeTree to technology (9 comments total)
If you are autofilling AD, you are unlikely to do it via a webpage that requires user entry. If you already have the AD values in CSV format, there are ways to do it, but your description is problematic (not in a bad way, necessarily), it just needs some more description

Reporting that information once asked for is a piece of cake, but I'm not sure what you're asking for here.
posted by Sparx at 5:08 PM on June 5


You can just craft your own post with parameters if you look at the source and get the names of the fields.

If you need to use the web form for some reason, Selenium should do the trick.
posted by Civil_Disobedient at 7:44 PM on June 5


Sparx, I think they're saying they already have a webpage which creates the account, but that it's a manual-entry process that could be automated.

Seconding Civil_Disobedient. Examine the source of the page and look for the form method. If your URL changes to something along the lines of:

http://www.yourdomain.com/usercreate.asp?username=phil&password=collins

...then it's a simple matter to craft a few of these requests with something like wget or curl and feed it the CSV. This would not involve a web browser at all, but may be problematic to do inside a Citrix window.
posted by odinsdream at 8:06 PM on June 5


If you're familiar with perl, I'd look at the WWW::Mechanize module. It's designed for this kind of thing.
posted by hattifattener at 9:18 PM on June 5 [1 favorite]


Very specifically, I am looking at a citrix window. This window asks me for fields to be filled in . Name, Email, desired password. This would simply create a user in the AD on the far side. Then I can reload the same window and do that again for user #2,# 3- #289. Assuming I have a CSV, I would like to be able to automate the creation of these user accounts.
posted by BrodieShadeTree at 11:32 PM on June 5


I just figured out a way to get to the user creator page without using CITRIX if this helps.
Here is the way it looks.
1. I go to site https://xxxyyyzzz.org/site2/um/adduser.aspx, I click ADD USER.
2. I get to https://xxxyyyzzz.org/site2/um/adduser.aspx, and fill in fields. Click ADD,
GOTO 1.
Repeat.

Can I automate this two page process?
posted by BrodieShadeTree at 11:44 PM on June 5


Look at the source code of the adduser.aspx page. Find the FORM tag and determine what the METHOD is currently set to.

Also determine what the Name, E-mail and Password fields are called within the FORM tag.
posted by odinsdream at 12:12 PM on June 6


I guess the question I am left with is, how do I get the csv to populate those forms now that I know how to submit them? Ie. I can create the script to run and fill the forms, but how to I get it to proceed through a csv file line by line each time it runs?
posted by BrodieShadeTree at 4:29 PM on June 6


I would use curl, which is available as part of Cygwin on Windows and comes on most Linux/Mac systems.

The relevant part is on this page down at: -F/--form <name=content>

I would start by getting one curl command working which submits the form and results in a user being added. Once you have designed that command, if this is going to be a routine process I would move to designing a script in whatever language you're comfortable with (I'd probably pick PHP or Perl) and get said script to parse your CSV and output the results line-by-line. Coordinate this with your curl command and run the whole thing with the CSV as input.

If this is more of a one-time task, I would probably just use Excel or a programmer's text editor, then use a few find-replace/formulas to associate the correct values row-by-row. Once I had the 300-some curl commands properly formatted in text I would then run this text file as a shell script.
posted by odinsdream at 7:30 AM on June 8


« Older Looking for a gardening tool &...   |   Recommend post-apocalyptic man... Newer »

You are not logged in, either login or create an account to post comments