在PowerShell中格式化变量表视图的输出

在PowerShell中格式化变量表视图的输出,powershell,tableview,Powershell,Tableview,从CSV文件检索信息。 我存储的值如下所示: 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' Informat

从CSV文件检索信息。 我存储的值如下所示:

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})
我想在代码窗口中输出tableview中的信息

使用
写入主机$FlexVPN.“IP地址”“$FlexVPN.“信息”“$FlexVPN.“优先级””、$Result.ResponseTime

给我数据,但不是我想要的结构


如何在tableview中格式化它?

为此使用PSCustomObject:

[PSCustomObject]@{
  "IP address" = $FlexVPN.'IP-adress'
  "Information" = $FlexVPN.'Information'
  "Priority" = $FlexVPN.'Priority'
  "Response time" = $Result.ResponseTime
}