ironmansoftware / universal-automation

Universal Automation is the PowerShell-first automation platform.
https://ironmansoftware.com/universal-automation/
MIT License
24 stars 4 forks source link

PSCusomObject not working with Pipeline ouput #159

Closed leeberg closed 4 years ago

leeberg commented 4 years ago

Describe the Issue

# Ping Check

# First Let's define a list of servers to monitor
$MonitoredServersSetup = @()
$MonitoredServers = @()
$Servers = @("www.google.com", "www.github.com", "8.8.8.8","192.168.0.1")

# Create some powershell objects to feed into our UI / Update Later
$Servers | ForEach-Object{
    $ServerObject = [PSCustomObject]@{
        Name = $_
        Server = $_
        #LastUp = (Get-Date)
        Status = $false
    }
    $MonitoredServersSetup += $ServerObject
}
$MonitoredServers = $MonitoredServersSetup

# New Endpoint to ping the server address of my "MonitoredServers Object - we'll also refresh the UD grid."
$MonitoredServers | ForEach-Object{
    $pingResult = Test-NetConnection $_.Server
    if($pingResult.PingSucceeded -eq $true)
    {
        $_.Status = $true
        #$_.LastUp = (Get-Date)
    }
    else {
        $_.Status = $false
    }

    # OUtput the Custom Object
    Write-Output $_

}

# OUtput a "reglar" powershell object
Write-Output (Get-Service | Get-Random)

Here is the job output:

image

Here is the pipeline output

image

Note

I get different results by including a "Name" property in my CustomObject

leeberg commented 4 years ago

@adamdriscoll working well in latest - anything you wanted to spruce up on this? otherwise I'd say we close it up.