Don Jones Talk on Input

A while ago (about a year?) there was a video posted of a talk given by Don Jones - at least I’m pretty sure it was him - on the subject of the best way to prompt for user input. I’d like to watch it again but can’t find it.

I’m asking because I’m writing a new Create User script in Powershell to replace our >2,000 line long VB script but I’m unsure of the best way to gather info (new user’s first name, last name, extension number, department, site, and so on) from the operator.


You can check his YouTube Channel. Before you ever get to a GUI, I would write and test the script\module that is going to be creating the users. Your only really filling in the blanks with variables. If you created a function New-TCUser (my mock company is TekCorp) and all you need to code in a GUI is

Import-Module TekCorpAD

$userParams = @{
    SamAccountName = $SamAccountName
    GivenName = $FirstName
    SurName = $LastName
    UserPrincipalName = "{0}.{1}" -f $FirstName, $LastName

$newUser = New-TCUser @userParams

Then you have something that could even create bulk users from a CSV. You provide the variables or appropriate properties and you have code that can be used any way you see fit.

As far as the GUI, you probably want to use a WPF or .NET form. If you use READ-HOST, you have to do more work to make sure someone entered the correct values, looping for mandatory, etc. in your workflow. With a GUI, you control the experience and items like Sites is a dropdown list. Sapien Powershell Studio is one of the best products to create forms with a WYSIWYG interface similar to Visual Studio and you could generate a form in a couple of minutes.

I used MS orchestrator for this task in my organisation, i still use allot of PS scripting in the runbooks, but it has the benifits of encrypted passwords, choosing which DC to use and much more. we also put a front end on this using .net (not written by me as .net is more like japanese to me :slight_smile: )

this way may not work for all but for me i like the flexibility of the standard MS integration packs that do 90% of the work for you, all the varibles are held in the initialise data fields.

couple pics

Thank you.

I did look in his YouTube channel but couldn’t see it there. I’m not sure it’s a video he owns (he was up on stage, I think at a Microsoft convention, so someone else was recording it).

This script isn’t for bulk creation, as we very rarely get more than one at a time.

A GUI sounds nice but isn’t a requirement (beyond Out-GridView), and if it costs any money at all then it’s a no-go anyway.

Thanks, Mark.

mandatory params is the quickest way to ensure user input.

Thank you.

I found the video. It’s not on his YouTube account, but is on the TechEd North America channel: Don Jones Best Practices talk at TechEd 2014

And as it turns out, the section I had in mind was more about output, rather than input (though he did also talk about input).