Welcome to Powergui.org - an open source community for Windows Powershell

PowerGUI.org PowerGUI.org and blogs

Forums » PowerGUI User Discussions

Thread: What's new in 1.0.8


Permlink Replies: 0 - Pages: 1
Dmitry Sotnikov


Posts: 1,151
Registered: 12/1/06
What's new in 1.0.8
Posted: Jul 2, 2007 6:15 AM
  Click to reply to this thread Reply

Below is a more detailed guide to the new features introduced in 1.0.8 (or introduced in 1.0.7 but made far more stable in 1.0.8 ). I think we've managed to incorporate a lot of feedback we were getting and hope that the new features will make PowerPacks even more powerful and the product even more GUI-like:

1. PowerPack description and System Requirements

 

You can now make PowerGUI display custom message (with URLs!) when importing your PowerPack, check for your system requirements, and automatically link to required PowerShell libraries. Here’s how to: You can now embed system requirements into PowerGUI

 

2. Changing labels in the path control above the grid

 

As you know the path control above the object grid and filters displays you the path whenever you use links to go somewhere. By default, the labels in the control are just the labels of the nodes and links you click. This sometimes becomes pretty stupid when you are browsing a structure. For example, you dig into public folders and the path you are getting is something like: Public Folders > Subfolders > Subfolders > Subfolders – not that useful.

 

Now you can customize the labels by adding the following line into your scripted link code:

[quest.powergui.hostfactory]::Current.Application.Action.Links.LinkLabel = "My custom label";

 

Of course you would probably want to use some attributes from the objects you operate rather than static text.

3. Dynamic Trees

 

This is one of the most advanced new features allowing you to dynamically create subtrees in the left-hand trees. This would allow you to browse hierarchies such as file systems, OUs, public folders, etc.

 

Here’s how you would implement the functionality.

 

Add the following code to your tree node (you can see this code in the Public Folders node of the Exchange pack shipped with PowerGUI 1.0.8 - just install on a box with Exchange 2007 management tools and see the node code in its properties):

# declare a custom function which PowerGUI would use to get the list of nodes – please try to make the name unique to avoid conflicts with other trees, use the parameter set which is applicable

function global:CreatePublicFolderChildNode($obj)

{

  # this is how you get the currently selected node

  $cur = [quest.powergui.hostfactory]::current.application.navigation.currentitem;

 

  # AddChild function adds a subnode and gives you the object back so you can set the label and the code

  $ch = $cur.AddChild();

 

  # Set the label

  $ch.Name = $obj.Name;

 

  # Set the code to be executed in case user clicks this new node

  $ch.Script = 'Get-PublicFolder ' + $obj.Identity + ' -GetChildren | foreach { CreatePublicFolderChildNode $_ }'

 

  # Return the object back so it gets into the grid as well

  $obj

}

 

# This is the code that gets you the root item and kind of kicks the tree-building process by calling the function.

Get-PublicFolder -GetChildren | foreach { CreatePublicFolderChildNode $_}

 

You can find another example in the attached filesystem.snapin file.

4. Smart Parameter Controls

 

Now whenever PowerGUI is able to get smart about a parameter type it gives you a rich control instead of a default edit box. This includes Booleans, enumerations, dates, and arrays.

 

To reproduce:

1.       1. Click Services node, select a service, click the Start action.

2.       2. Try changing the Confirm parameter – it is Boolean (true/false) or specify ErrorAction (it is an enumeration).

 

Date control can be found in the Date parameter if you add a Get-Date node.

 

To see how array parameters work:

1.       1. Right-click the Services node, and click Properties.

2.       2. Try modifying the Exclude or Include parameters.

5. PSCX Compatibility

Can be installed (without any command-line tweaks) on the computer which has Microsoft’s community extensions for PowerShell.




Legend
MVP: 2501 + pts
Guru: 2001 - 2500 pts
Expert: 751 - 2000 pts
Enthusiast: 31 - 750 pts
Novice: 0 - 30 pts
Moderators
Helpful answer (5 pts)
Answered (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums