/\/\o\/\/ PowerShelled

This blog has moved to http://ThePowerShellGuy.com Greetings /\/\o\/\/
$AtomFeed = ("Atom.xml")
$PreviousItems = (" PowerShell AD site Finder "," PowerShell and SMS 2003 "," Upgrading MSH, My first Windows PowerShell Commands "," Some more Windows PowerShell Links and info. "," Windows PowerShell (Monad / MSH) "," Simple port scanning using Monad "," Large AD queries in Monad "," Sharepoint provider for Monad "," access ADSI WinNT provider from Monad Part 2 "," MSH Community Workspace, TFSC provider and videos "," ")

Thursday, April 27, 2006


PowerShell out-PropertyGrid (MSH view-Object)

As with the switch from Monad to PowerShell there where some breaking changes, I have started a walk trough my blog history, and will re-do some of the scripts.
I will start with the first script on my blog :
MSH Object Viewer

I posted this script also on the NG some time before, and got a great suprise when I did watch the second Channel 9 video with Jeffrey Snover :
MSHObjectViewer mentioned in More talking about Monad (links to all the channel 9 videos you can find in the $links section in the bottom of the blog)

The script will take a Object from the commandline (If you use the PowerShell Analyzer or VS it will look familiar ;-))

B.T.W. Karl did also update his MSH analyzer to PowerShell Analyzer, if you don't know this great PowerTool check out his blog Karl Prosser - Klumsy Geek

I did add the -noBase switch (but it seems not needed that often anymore)

and I did add a -array switch as I made the function also take pipeline input, I did rename it and fixed the Focus issue (for more info search for GUI in the blog), now you can use it like this

out-propertyGrid (get-date)

opg (LS)

opg (ls)[0# shows first file / dir

ls | opg # shows last file (check the date editor ;-)

ls | opg -array # shows list

gwmi win32_operatingsystem | opg # note that you can browse in the Grid !

gwmi win32_share | opg -a

if you have a WMI Object in the PropertyGrid, try to open the properties, you get a nice list. Also try to change a date of a file you get a nice calendar.

the MSHObject (PsObject) was needed in the old beta as otherwise I did get the wrapperObject, so maybe its better to make the shitch called -PsObject and change it to $psObject.PsObject)

here is the Updated script :

# out-PropertyGrid.ps1   
# will show an Object in a PropertyGrid (propertywindow in Visual Studio) 
# this is an easy way to look at MSH objects, you can read / write the object properties.
# /\/\o\/\/ 2006   
# http://mow001.blogspot.com

Function out-PropertyGrid {
  Param ($Object,[switch]$noBase,[Switch]$array)
  $PsObject = $null
  if ($object) {
    $PsObject = $object
     if ($Array.IsPresent) {
       $PsObject = @()
       $input |% {$PsObject += $_}
       $input |% {$PsObject = $_}
  if ($PsObject){
    $form = new-object Windows.Forms.Form 
    $form.Size = new-object Drawing.Size @(600,600
    $PG = new-object Windows.Forms.PropertyGrid 
    $PG.Dock = 'Fill' 
    $form.text = "$psObject" 
    if ($noBase.IsPresent) {"no";
      $PG.selectedobject = $psObject 
      $PG.selectedobject = $psObject.PsObject.baseobject 
if (!(get-command -ea SilentlyContinue opg)) {set-alias opg out-PropertyGrid}


Greetings /\/\o\/\/
Tags :

Comments: Post a Comment

<< Home


October 2005   November 2005   December 2005   January 2006   February 2006   March 2006   April 2006   May 2006   June 2006   July 2006   August 2006   September 2006   October 2006   November 2006   December 2006  

$Links = ("PowerShell RC1 Docs"," PowerShell RC1 X86"," PowerShell RC1 X64"," Monad GettingStarted guide"," Monad Progamming Guide"," Monad SDK"," Monad videos on Channel 9"," MSH Community Workspace"," scripts.readify.net "," MonadSource"," www.reskit.net"," PowerShell Blog"," Under The Stairs"," computerperformance powershell Home"," proudlyserving"," MSH on wikipedia"," MSHWiki Channel 9"," Keith Hill's Blog"," Precision Computing"," PowerShell for fun"," MSH Memo (Japanese)"," monadblog")

find-blog -about "PowerShell","Monad" | out-Technorati.
find-blog -contains "","" | out-Technorati.
Web mow001.blogspot.com

This page is powered by Blogger. Isn't yours?