I have the following code, from what I would like to get the output to
$output
and write-host at the end:
$outputs = @()
foreach ($comp in $maschines.name) {
$output = New-Object PSObject -Property @{
invoke-command -computer comp3 -ScriptBlock { get-vm –VMName $using:comp | Select-Object VMId | Get-VHD | ft @{
label="vm"; expression={$using:comp}},
path,
VhdType,
VhdFormat,
@{label="file(gb)"; expression={($_.FileSize / 1GB) -as [int]}},
@{label="size(gb)"; expression={($_.Size / 1GB) -as [int]}} -AutoSize
}
}
$outputs += $output
}
$outputs
I get the error
Missing '=' operator after key in hash literal