0

Retrieves information from a CSV-file. I store the values like this:

Foreach($FlexVPN in $FlexVPNlist) {

    # Number of pings
    $Ping = $FlexVPN.'Priority'

    $Test = New-Variable -Name $FlexVPN.'IP-adress' -Value (New-Object PSObject -Property @{
    IP = $FlexVPN.'IP-adress'
    Information = $FlexVPN.'Information'
    Priority = $FlexVPN.'Priority'
    ResponseTime = $Result = Test-Connection -ComputerName $FlexVPN.'IP-adress' -Count $FlexVPN.'Priority' -ea silentlycontinue | Select ResponseTime})

I would like to output in code window the information in a tableview.

Using Write-Host $FlexVPN.'IP-adress' "," $FlexVPN.'Information' "," $FlexVPN.'Priority' "," $Result.ResponseTime

Gives me the data but not the structure I want.

How should I do to format it in tableview?

1 Answer 1

1

Use a PSCustomObject for this:

[PSCustomObject]@{
  "IP address" = $FlexVPN.'IP-adress'
  "Information" = $FlexVPN.'Information'
  "Priority" = $FlexVPN.'Priority'
  "Response time" = $Result.ResponseTime
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.