Hi,
How can I put all hosts under one variable or instance to run one command against all hosts.
Thank you
You use an array (in fact PowerShell will do that for you).
So if you do
$esx = Get-VMHost
and if you have more than 1 ESXi node in your environment, the variable $esx will be an array, each element being one VMHost object.
Most of the PowerCLI cmdlets that take an ESXi node as a parameter, support giving more than one ESXi host.
That can be seen by looking at the square brackets on the cmdlet syntax.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You use an array (in fact PowerShell will do that for you).
So if you do
$esx = Get-VMHost
and if you have more than 1 ESXi node in your environment, the variable $esx will be an array, each element being one VMHost object.
Most of the PowerCLI cmdlets that take an ESXi node as a parameter, support giving more than one ESXi host.
That can be seen by looking at the square brackets on the cmdlet syntax.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Great
Thank you