header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
$tmp = $f | gm -membertype noteproperty | select name
Last Post 02 Jul 2010 03:00 PM by mipbar. 4 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
mipbarUser is Offline
New Member
New Member
Posts:15
Avatar

--
02 Jul 2010 12:12 PM
    How can I get the names into the $tmp variable in the same order they are displayed with a $f | ft ?

    The names come into $tmp sorted
    PoSherLifeUser is Offline
    Basic Member
    Basic Member
    Posts:364
    Avatar

    --
    02 Jul 2010 12:20 PM
    look at what property they are being sorted under when using ft, then specify a sort by that property name:

    $f | gm -membertype noteproperty | sort [property_name] | select name
    When at first you don't succeed Step-Into

    http://theposherlife.blogspot.com
    http://www.jandctravels.com

    mipbarUser is Offline
    New Member
    New Member
    Posts:15
    Avatar

    --
    02 Jul 2010 12:47 PM
    They aren't sorted with ft alpabetically, is there a way to pull out the order ft uses? they are shown in this order as intended

    MBXs
    Database
    DBSize(GB)
    LogFree(GB)
    DBFree(GB)
    ServerCount

    When I run
    $hdr = "html stuff here that this editor keeps converting"
    $tmp = $f | gm -membertype noteproperty | select name
    $tmp | %{$c=$_.name.tostring();$hdr += "more html stuff this editor is converting"}
    $hdr += "more html stuff"

    It comes out as
    Database
    DBFree(GB)
    DBSize(GB)
    LogFree(GB)
    MBXs
    ServerCount






    PoSherLifeUser is Offline
    Basic Member
    Basic Member
    Posts:364
    Avatar

    --
    02 Jul 2010 01:57 PM
    If you're sorting the property names just put them into select-object in the order you want

    $object | select Prop1,Prop2,Prop3
    When at first you don't succeed Step-Into

    http://theposherlife.blogspot.com
    http://www.jandctravels.com

    mipbarUser is Offline
    New Member
    New Member
    Posts:15
    Avatar

    --
    02 Jul 2010 03:00 PM
    That negates all benefits.  I have 50 scripts I'm converting to HTML output from CSV output.  Each script builds a powershell table of output information.  If I can build the html data directly from those tables without manually specifying each tables headers then I can simply copy this html building function into each script, and as long as the starting variable, that contains the powershell table,  is the same, each script will generate HTML output.  Easy.

    If I have to manually specify each headers properties, for each script, it turns into a pretty severe headache.

    Format-Table(or any output like Format-List)  orders the column headers, somehow I should be able to pull the header names and order out.   Man, this is driving me crazy.  I cannot think of a way to pull this simple column header information out in the order it goes in.


    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer