Create graphical programs with PowerShell – The Start

This is an updated post from my series about “Creating graphical programs with PowerShell” that I wrote in 2013.
The series was first published on and from part 3 on

This is an updated version and I will use another setup in my Lab environment then back in 2013.

In this first part I will show you how to start using PowerShell Studio and how to do the first part of the design of the form.

My lab environment for this blog series is:

  • Windows Server 2016 with Active Directory
  • PowerShell studio 2017

I will show you how to make a simple form at the beginning and then how to extend it and make it more intelligent later on.

Start up PowerShell Studio and go to File | New and then point the mouse to the right arrow and chose New Form and then Empty form.

Now we have an Empty Form to start with.

This is the time to start thinking on how much information we want and needs to add to the user account. It will make our life easier later on. Trust me 🙂

We will use the PowerShell cmdlet New-ADUser from the module ActiveDirectory that comes with Windows Server 2016.

All information about it can be found here:

To create a user with New-ADUser we at least need to use the parameter name.
As default it then will create the user with that name as name and SamAccountName.

Later on we need to decide on how to do with this.
But, do we want a text box for this or do we want PowerShell to fix this for us?

This should be a unique name and there for I think the script should handle this.

I think we need to add this to our form:

  • Given name (TextBox)
  • Surname (TextBox)
  • Displayname (TextBox)
  • Description (TextBox)
  • Password (TextBox)
  • Enabled (CheckBox)
  • OU (ComboBox)
  • Country (ComboBox)
  • Office (ComboBox)
  • Telephone (TextBox)
  • Status (RichtextBox)
  • Quit (Button)
  • Clear (Button)
  • Create (Button)
  • Status Bar (StatusBar)

I always uses GroupBoxes instead of labels.
You can do this or use labels to your textBoxes etc in the form.

Maybe we need to add more later on, but this should do the trick for now on.

Some of the information will be added from the Active Directory. But this will be in later posts.

To start with we need to change the size of the form:

Move the mouse over that corner until the pointer turns in to a arrow and then press the mouse and drag it to to the right and down until you think you have a nice size of the form.

A tip from the real world:
Make a form that fits your screen resolutions on the Workstations/Servers where the script will be running from when in production. Or else you might end up with people that can’t see the whole form.

So a form that is wide and not so high might be a better solution then a high and not so wide form.

My form is 1005 x 543.

You will find the size at the right side of PowerShell studio.
If you do not see it, click on the form so it’s highlighted and make sure that the you have selected properties (in the red circle). It should be the default selection.

When we have a form to work with I like to start to make a GroupBox for all the User Information and one for the status information. Plus all of the buttons.

I think this gives me a view over how it can be in the long run.

Here is how you do this:

On the left side of PowerShell Studio you will find the Toolbox window.

To start with the first control to the form just click on the GroupBox and hold the mouse button down and drag it to the form and where you want it.

If you click on any of the controls and then push G, you will find the GroupBox easier.
Or you can use the search function at the top of the toolbox.

If this is the first time using one of Sapiens editors for making forms for Powershell then a tip is to drag it slow and let the editor show when it’s a good place to drop it.


When you have dropped it into the form, then you can drag the round corners around the group box to make it as big or small as you want.


When you think it’s okay for now then it’s time to change the text on the GroupBox and change the name if it’s needed.

Click on the GroupBox to mark it.

Now you should see this on the right side.
It’s the properties for the first GroupBox.

Find Text under appearance and change it from “groupbox1” to “User Information”.
Then find name under Design and change it to “grpBoxUserInformation”.

Now create the next GroupBox by do the same thing and place it to the right of this first GroupBox.

When dragging this form control up and down on the side of the first one then you will se a blue line that tells you that both controls are at the same level.

Change the size of this GroupBox as you did with the first one. And then change the text and name for it too.

Text: Status
Name: grpBoxStatus

Now it’s time for the three buttons.

Click on the Button control and drag it to the lower right corner of the status GroupBox. You will see the the lines when the editor thinks it’s in a good place.

Click on the Button control again and do the same thing two more times.
This time you will also get a blue line so you can see that the other Buttons is in the same line a the first button.

Click on each button and go to the properties and change the following:

Text: Quit
Name: btnQuit

Text: Clear
Name: btnClear

Text: Create
Name: btnCreate

The result should look something like the picture above.

You can find my PowerShell studio file here  if you like to see how it should look by now.

This was the first part of this series and I will post the second one as fast as I can.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.