Archive for the ‘showui’ Tag

Meeting Notes – April 3rd   Leave a comment

This evening we had our first script club meeting! The format was that members bring scripts, ideas or questions and we work through them as a group. We took a good look at some scripts that have been used for provisioning new user accounts and generating wiki documentation from PowerShell MAML help. We also work through some snippets involving hash tables and advanced functions. We also took at a look at some ways to produce GUIs in PowerShell. This included a quick look at Windows Forms, ShowUI and Primal Forms. Below are some of the snippets from tonight’s meeting.

If you’re interested in joining, feel free to show up on the first Tuesday of the month. If you have any questions about the group or the scripts posted below, please email the group using the Google Group.

Test-ConnectionPort

function Test-ConnectionPort()
{
	[CmdletBinding()]
	param(
		[Parameter(ValueFromPipeline=$true)]
		$Server,
		[Parameter()]
		$Port
	)

	Begin
	{
		$script:ping = new-object System.Net.Sockets.TcpClient
	}

	Process 
	{

		try 
		{
			$ping.Connect($server, $port)
			Write-Host "Succeeded"
		}
		catch
		{
			Write-Host "Failed"
		}
	}
}

Show UI Example

Import-Module ShowUI

$Window = window {
   stackpanel {
      label "Hey"
      TextBox "TxtBox"
      Button "MyButton"
   }
}
$Window.ShowDialog()

Windows Forms UI

Add-Type -Assemblies System.Windows.Forms

$form = New-Object System.Windows.Forms.Form
$form.ShowDialog()

Meeting Stats

  • 6 members in the room
  • Meeting lasted about 2 hours
  • 2 pizzas eaten

Posted April 3, 2012 by adriscoll86 in Meeting

Tagged with , , ,