New Poweradmin tool released

I released a Poweradmin tool some days ago and it can be found here,
http://powershelltaskforce.com/2014/04/uninstall-string-tool/

This is the first tool in a new series of tools that I have made with PowerShell Studio and are GUI based PowerShell scripts that will help out when working with applications.

Skärmklipp

This tool will get the Uninstall String for one or more applications from a local or remote computer

Posted in PowerShell, Powershell Studio, Windows | Leave a comment

More posts in the GUI series

Hello,

the action here have not been so good.
I will hopefully start to blog here again soon.

But until then my post serie about creating GUI based PowerShell scripts continues
on PowerShellTaskForce.com.

Part 3
http://powershelltaskforce.com/2013/12/language-file-for-gui-based-scripts

Part 4
http://powershelltaskforce.com/2013/12/add-some-actions-to-the-gui-form

and part 5 will be posted automaticaly in 8 hours on http://www.powershelltaskforce.com

Posted in News, PowerShell, Powershell Studio | Tagged , , , | 2 Comments

Create graphical programs with PowerShell–Part 02

In this second part of this blog series I will show you how to make the user part of the form.

As I said in part 01 I like group boxes.

So we start to create two Groupboxes.
One for the Given name and one for Surname.

Just drag a GroupBox from Controls toolbox to the form just under the User Information GroupBox that we created in part 01.

Then do the same with a another GroupBox and put it at the right side of the fist one.
As in the picture bellow.

image

When these are created, click on the first GroupBox and change the following properties:

Text: Given Name
Name: grpBoxGivenName

Then change the second one to:

Text: Surname
Name: grpBoxSurname

Now it’s time to add TextBoxes to Given Name and Surname.

Just drag a TextBox from the Control Toolbox and under the Given name GroupBox.
Like the picture bellow. And when it is where you want it just drop it.

image

Then drag the TextBox in the right corer to the right side of the GroupBox.

image

image

When the Given Name TextBox is in place. Do the same thing with the Surname TextBox.

image

When finished with that it’s time to give those TextBoxes new names.
Click on the first text box in the Givenname GroupBox.

Go to the properties and change:

Name: txtBoxGivenname

image

Then change the second textBox to:

Name: txtBoxSurname

Now we have two TextBoxes in our Form.

image

To speed things up a little bit we can copy the two TextBoxes we just created including GroupBoxes for our next step.

Displayname and Description

Go to the form and place the pointer just left of the Given Name, press the left mouse button and drag the mouse to just under the lower right of the Surname GroupBox

image

and drop it.

image

Now it should look like the picture above.

Pres Ctrl-C and then Ctrl-V

image

Now you will get a new set of the copied Given name and Surname just in front of the old one. Click on the four arrows like in the picture above and drag everything to a new space bellow Given name and Surname.

image

It’s time to change the text and name for both the GroupBoxes and TextBoxes for our new controls.

Click on the copied Given name GroupBox, go to Properties and change it to:

Text: Displayname
Name: grpBoxDisplayName

Do the same thing with the copied Surname GroupBox and change these properties:

Text: Description
Name: grpBoxDescription

And then we have the both TextBoxes left.

The Displayname TextBox

Name: txtBoxDisplayName

The Description TextBox

Name: txtBoxDescription

The form should look like this now:

image

For the Telephone and Password TextBoxes we will do the same copy procedure.

Copy the Given name and Surname Groupboxes and TextBoxes as you did before.
Drag them to below the Displayname GroupBox and drowp it.

Telephone

GroupBox
Text: Telephone
Name: grpBoxTelephone

TextBox
Name: txtBoxTelephone

Password

GroupBox
Text: Password
Name: grpBoxPassword

TextBox
Name: txtBoxPassword

image

Now we have these things left:

  • Enabled (CheckBox)
  • OU (ComboBox)
  • Country (ComboBox)
  • Office (ComboBox)  
  • Status (RichtextBox)
  • Status Bar (StatusBar)

Now add four GroupBoxes as the picture below.

image

Then change the properties as bellow.

OU

Text: OU
Name: grpBoxOU

Enabled

Text: Enabled
Name: grpBoxEnabled

 

Country

Text: Country
Name: grpBoxCountry

Office

Text: Office
Name: grpBoxOffice

 

It’s time to add ComboBoxes to the OU, Country and Office GroupBoxes.

Drag and drop them in the right GroupBoxes and then drag them so they will fit in the GroupBox. Like the picture below.

image

Change the properties for these ComboBoxes:

OU

Name: comboboxOU

Country

Name: comboboxCountry

Office

Name: comboboxOffice

 

Add a CheckBox to the Enabled GroupBox.

image

Change the following properties:

Name: checkboxEnabled
Text: (blank)
Size: 16;24

And move the CheckBox to the middle of Enabled GroupBox.

image

Drag a RichTextBox from the Controls Toolbox to the status GroupBox and drag the corners so it fit the status GroupBox as the picture bellow.

image

Change the property

Name: richtextboxStatus 

Then it’s only the StatusBar left for the making of the form for this part of the blog series.

Drag and drop a StatusBar to the lower left corner of the form.

image

Change the properties

Name: statusbar
Text: (blank)

The form is now ready for this stage and have an okay look.
We will change it a bit in the next part, before we starts to add own code to the script.

image

 

You can find my PowerShell studio file here.

This is the end of part 02.

Part 01 can be found here.

Posted in PowerShell, Powershell Studio | Tagged , , , , , , | 3 Comments

Create graphical programs with PowerShell–Part 01

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.

You don’t need to go buying PowerShell studio to start this blog series.
PowerShell studio have a 45 days of  trial before you need to buy it.

My lab environment for this blog series is:

  • Windows Server 2012 with Active Directory
  • PowerShell studio 2012 (Trial)

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.

image

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 Smile

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

All information about it can be found here:
http://technet.microsoft.com/en-us/library/hh852238(v=wps.620).aspx

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:

image

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.

image

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.

image

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.

image

Here is how you do this:

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

image

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 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.

imageimage

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.

image

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.

image

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.

image 

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

image

Now it’s time for the three buttons.

image

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:

button1
Text: Quit
Name: btnQuit

button2
Text: Clear
Name: btnClear

button3
Text: Create
Name: btnCreate

image

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.

Posted in PowerShell, Powershell Studio | Tagged , , , , | 5 Comments

Create graphical programs with PowerShell– The blog series

DXter and I did a short session on PowerShell Community day 2013 here in Sweden this Thursday about Create graphical programs with PowerShell.

It’s was a demonstration on how to build a “Create AD user account” application.

image

This was the result and It added a user account to the default user container in Active Directory with the help of the Powershell module Activedirectory in Windows Server 2012.

It was a basic application that shows that It can be done and we did not come to the part when to show how to get some output too.

In this blog series I will go from start in Powershell Studio and show how you can create a more advanced Create AD account application.

Part 1 will be added this evening and then I will add one part each week until we have a good foundation to start on.

Posted in PowerShell | Tagged , , , , | Leave a comment

PowerShell + Working with applications–custom view

Programs and features will not give you much information about an application.

image

But if we take my post from yesterday and modify it then we can get this.

image

It’s just a oneliner:
Get-WmiObject win32_product | Select-Object -Property Name, Vendor, Version, IdentifyingNumber | sort -Property Name

And if you want to know what more properties you can find about all installed applications you can do like this:
Get-WmiObject win32_product | Select-Object -Property *

The properties URLInfoAbout, URLUpdateInfo and HelpLink can be nice to have too…

Posted in Deployment, PowerShell | Tagged , , | 2 Comments

PowerShell + working with applications–Find Identifying Number

Often when working with applications you need the Identifying Number to identify the application for uninstalling/installing etc

For example, I want to uninstall Safari on machines using MsiExec.exe /X and to use with a logon script or to use with sccm or similar to automate an uninstallation.

On one of my computer I have Safari installed. If we look in Programs and features we will not get the Identifying number.

image 

The way lots of people will do is to look in the registry and under:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
or
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\

The problem is that in most of the cases you need to look in lots of registry keys to find the right one.

image

Another and an easy way is to just open up PowerShell and write:

$myApp = “Safari”
$app = Get-WmiObject win32_product | Where-Object {$_.name -match $myApp}
$app.IdentifyingNumber

The output will give us “{C779648B-410E-4BBA-B75B-5815BCEFE71D}”

Posted in Deployment | Tagged , | 4 Comments