あなたの質問はかなり短期間であり、想像力に多大な影響を与えます。しかし、きれいにフォーマットされた出力を生成するために、複数のソースから情報の配列を集めて組み合わせたいと思うようです。私はあなたに役立つかもしれない(またはそうでないかもしれない)例を提供することができます。この例では、複数のマシンからHotFix情報(@PetSerAIごと)を収集し、Format-Tableにパイプされた各修正プログラムのオブジェクトを返します。
<#
.Synopsis
Gather HotFix Info
.DESCRIPTION
Gather HotFix Info from one or more computers
.EXAMPLE
@("LCFSQL01","LCFSQL02","LCFSQL03","LCFSQL05") | Gather-HotFixInfo
Gathers info for several remote machines
.EXAMPLE
Gather-HotFixInfo -Machine = "LCFSQL01"
Gathers info for a single remote machine
#>
Function Gather-HotFixInfo
{
[CmdletBinding()]
Param
(
# Machine remote machine name
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
Position=0)]
[string]$Machine
)
Process
{
Try
{
Get-HotFix -ComputerName $machine | ForEach-Object {
[pscustomobject]@{Name=$_.CSName;
Description=$_.Description;
HotFixID=$_.HotFixID;
Doggo="Doggo"}
}
}
Catch
{
Write-Warning "Could not connect to $machine"
}
}
}
# List of all computers from which to gather info
@("LCFSQL01","LCFSQL02","LCFSQL03","LCFSQL05") | Gather-HotFixInfo | Format-Table
は、なぜあなたはそれを代わりにそのように行うのですか、 '$ EnvironmentInfo = @([PSCustomObject] {名= '名1' @;説明= '説明1';出版社=「出版社1 'Doggo =' Doggo 2 '}) '; Dooggo =' Doggo 1 '}; [PSCustomObject] @ {Name =' Name 2 '; Description =' Description 2 '; – PetSerAl
希望の出力を表示してください。 –
@PetSerAl私は何とかGet-Hotfixをpscustomobjectの配列にパイプすることができますが、ちょうど良い気分にならないと思います。 – Fullmetal99012