Paul,
To answer your question, I did copy and paste the code from your 2nd post.
The code you just provided does work. Yeah!!! Thank you.
I've condensed the code down to this (which works):
#gather output
$wmioutput = gwmi win32_bios;
$wmioutput | gm -mem property | select name |
foreach {
$propname = $_.name;
add-member -inputobj $_ -membertype noteproperty `
-name Value -value "$($wmioutput.$propname)" -PassThru
} |
convertto-html | out-file C:\test.html
But, when I attempt to combine the first two lines (like you did in your
first example), I again no longer get the 2nd column in the output:
#gather output
gwmi win32_bios | Tee-Object -var wmioutput |
gm -mem property | select name |
foreach {
$propname = $_.name;
add-member -inputobj $_ -membertype noteproperty `
-name Value -value "$($wmioutput.$propname)" -PassThru
} |
convertto-html | out-file C:\test.html
But, if I assign the output of Tee-Object to a variable which I then feed
back into the pipe, it works, as follows:
#gather output
$tmpPipe = gwmi win32_bios | Tee-Object -var wmioutput
$tmpPipe | gm -mem property | select name |
foreach {
$propname = $_.name;
add-member -inputobj $_ -membertype noteproperty `
-name Value -value "$($wmioutput.$propname)" -PassThru
} |
convertto-html | out-file C:\test.html
At the moment, I'm baffled as to why would assigning the output of
Tee-Object to a variable and the feeding it back into the pipe works, while
piping the output of Tee-Object directly doesn't.
Thanks again for all your assistance,
Richard
"PaulChavez" wrote:
> Have you tried just copying and pasting directly out of my second post?
>
> I was just able to do that and get correct output.
>
> Here's the same method broken down into discrete steps so you can check each
> command for correct output.
>
> #gather output
> $wmioutput = gwmi win32_bios;
> $propnames = $wmioutput | gm -mem property | select name;
> #check both variables
> $wmioutput;
> $propnames;
> #try to use add-member
> $propnames | foreach {
> $propname = $_.name;
> add-member -inputobj $_ -membertype noteproperty `
> -name Value -value "$($wmioutput.$propname)"
> }
> #check $propnames to see if values stuck
> $propnames
> #assuming it's all ok then convert to html
> $propnames | convertto-html | out-file test.html
>
> Again, I used the backtick to put the add-member command on two lines
> because of the line wrapping when using the web form for posting here.
>
> good luck,
> Paul
>
> "Richard Rosenheim" wrote:
>
> > Paul,
> >
> > I tried it again with both the backtick, and on one line. I'm still not
> > getting any values in the 2nd column.
> >
> > Below is the resulting HTML output.
> >
> > Richard
> >
> >