Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7519715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:56:56+00:00 2026-05-30T01:56:56+00:00

I have a command Get-Testdata that retrieves test data from different sources and stores

  • 0

I have a command Get-Testdata that retrieves test data from different sources and stores these into a PSObject with the different values as properties. The total number of objects are then stored as an array, for easy manipulation, sorting, calculating etc.

My problem is that I want to be able to present this data as (color-coded) HTML, for which I’ve written another command, Show-TestResults. The input parameter looks like this

[Parameter(Mandatory=$true,Position=0,ValueFromPipeline=$true)]
[PSObject[]]$InputObject

UPDATE 1

This function itself is very basic, it simply sets some parameters for ConvertTo-HTML and then pipe the objects into that command:

$head = "<style>[...]" #styling with javascript etc
$header = "<H1>Test Results</H1>
$title = "Test results"
$InputObject | ConvertTo-HTML -head $head -body $header -title $title | Out-File $Filename

END UPDATE 1

However, when I try to use the ValueFromPipeline property, using the call

Get-Testdata [...] | Show-TestResults 

only the first object in the array is shown. But if I instead call the command like

$td = Get-Testdata [...]
Show-TestResults $td 

The whole array is presented, as expected. Can someone explain this – and hopefully guide me into correcting it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:56:57+00:00Added an answer on May 30, 2026 at 1:56 am

    You probably process data in end block, not process block.

    Look at an example:

    function getdata {
        1
        2
        3
        4
    }
    function show-data {
        param(
            [Parameter(mandatory=$true, ValueFromPipeline=$true)]$InputObject,
            [Parameter(mandatory=$true)]$FileName
        )
    
        # this is process block that is probably missing in your code
        begin { $objects = @() }
        process { $objects += $InputObject }
        end {
            $head = "<style></style>"
            $header = "<H1>Test Results</H1>"
            $title = "Test results"
            $objects | ConvertTo-HTML -head $head -body $header -title $title | Out-File $Filename
        }
    }
    
    getdata | show-data -file d:\temp\test.html
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this command that I run everyday via cron: find /home/get/public_html/videos -daystart -maxdepth
I have a command-line utility that gets quite a bit of downloads from my
I want to execute a command, have the output of that command get gzip'd
I have a command line executable that alters some bits in a file that
I have a command that runs fine if I ssh to a machine and
I have a command line app the continuously outputs YAML data in the form:
Have tried spooling, have tried command line notation: log \\networked_location\rman.log Nothing works to get
I have this command (visibleSelect is jquery variable that holds multiple select list): var
I have IE8 add-on that needs to know command line arguments specified by user.
I am receiving data from a device that's sending information over the serial port

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.