Hello,
I discover powershell and PowerCLI.
I search list the Upgrade Policy Tools of all VM.
This script work's fine :
$report = @()
Foreach ( $v in Get-vm ) {
$vm = Get-View $v
$vms = "" | Select-Object VMName, ToolsUpgradePolicy
$vms.VMName = $vm.Name
$vms.ToolsUpgradePolicy = $vm.Config.Tools.ToolsUpgradePolicy
$report += $vms
}
$report | Sort ToolsUpgradePolicy
But, the ToolsUpgradePolicy column is not display, only VMName column.
If i add " | ft -auto" in the end, it's ok
Why?
Thx for your answer
The PowrShell output formatter tries to place as much information as possible on the console.
For that it follows some rules. See How PowerShell Formatting and Outputting REALLY works
With the Format-Table -AutoSize instruction, you change the default behaviour.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The PowrShell output formatter tries to place as much information as possible on the console.
For that it follows some rules. See How PowerShell Formatting and Outputting REALLY works
With the Format-Table -AutoSize instruction, you change the default behaviour.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference