Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - RE: variable identification

Reply
 
Old 03-27-2007   #1 (permalink)
Rob Campbell


 
 

RE: variable identification

This sounds like it might be a job for new-hashobject.

It's part of the PowerShell Community Extensions 1.1.

It converts a hash table to a custom PS object, with the key names as
properties, and the associated key value as the property value. Then you can
aggregate them as collections and do things like export-csv for output.

"Neil Chambers" wrote:

> Hello Powershell Gurus,
>
> I'm looping through a large number of hashtables and sending data to excel.
> In order to have the data nicely formatted I am currently laying out the
> row/column headers to pre-defined locations. What I'd like to do is pull
> header information directly from the datastore.
>
> The only (dooable) thing that comes to mind right now is to load information
> about the hashtable in the first keypair. This is certainly achievable but
> I'm hoping there is something else, something marvelous, that might help. Is
> it possible to 'name' a powershell hashtable object other than the assigned
> object name? For that matter, is it possible to find the variable name eg.
>
> *wish 1
> $mytable.hiddenProperty.VarName = "Cheese Stock"
> $mytable.hiddenProperty.VarDescription = "a table of cheese stock items"
>
> *wish 2
> foreach ($table in $table1,$table2,$object1,$variable4){
> 'show me the inherited variable name of $table
> or
> 'show me the super-secret hidden 'variable name' property which I set
> earler
> }
>
> As I'm writing this out another option comes to mind: I could group my
> tables into another table and set the values as descriptions. Not as nice as
> the (surely they exist) hidden properties.
>
> Ideas, anyone?
>
> Cheers
> neil
>


My System SpecsSystem Spec
Old 03-28-2007   #2 (permalink)
Neil Chambers


 
 

Re: variable identification

Oooh. lovely extensions. I'll certinaly give that a go.

Thanks Rob!
"Rob Campbell" <RobCampbell@discussions.microsoft.com> wrote in message
news:95E4BA8A-4C5B-4C63-9F80-41BDF9A71C1B@microsoft.com...
> This sounds like it might be a job for new-hashobject.
>
> It's part of the PowerShell Community Extensions 1.1.
>
> It converts a hash table to a custom PS object, with the key names as
> properties, and the associated key value as the property value. Then you
> can
> aggregate them as collections and do things like export-csv for output.
>
> "Neil Chambers" wrote:
>
>> Hello Powershell Gurus,
>>
>> I'm looping through a large number of hashtables and sending data to
>> excel.
>> In order to have the data nicely formatted I am currently laying out the
>> row/column headers to pre-defined locations. What I'd like to do is pull
>> header information directly from the datastore.
>>
>> The only (dooable) thing that comes to mind right now is to load
>> information
>> about the hashtable in the first keypair. This is certainly achievable
>> but
>> I'm hoping there is something else, something marvelous, that might help.
>> Is
>> it possible to 'name' a powershell hashtable object other than the
>> assigned
>> object name? For that matter, is it possible to find the variable name
>> eg.
>>
>> *wish 1
>> $mytable.hiddenProperty.VarName = "Cheese Stock"
>> $mytable.hiddenProperty.VarDescription = "a table of cheese stock items"
>>
>> *wish 2
>> foreach ($table in $table1,$table2,$object1,$variable4){
>> 'show me the inherited variable name of $table
>> or
>> 'show me the super-secret hidden 'variable name' property which I set
>> earler
>> }
>>
>> As I'm writing this out another option comes to mind: I could group my
>> tables into another table and set the values as descriptions. Not as nice
>> as
>> the (surely they exist) hidden properties.
>>
>> Ideas, anyone?
>>
>> Cheers
>> neil
>>


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Re: WMP 11 DVD identification Vista music pictures video
WMP 11 DVD identification Vista music pictures video
another question about variable identification PowerShell
Re: variable identification PowerShell
How can I ensure that a variable is a built-in powershell variable? PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46