Hi,
Beginners question...
Using this command: Get-VMHost | Get-VMHostStartPolicy
I get this result:
VMHost Enabled StartDelay StopAction StopDelay WaitForHeartbeat
------ ------- ---------- ---------- --------- ----------------
HostSystem-ha-host True 120 GuestSh... 120 False
HostSystem-ha-host True 120 GuestSh... 120 True
HostSystem-ha-host True 120 GuestSh... 120 False
How to make it show the VMHost instead of the "HostSystem-ha-host"?
Like:
Name Enabled
--------- --------
Server1 True
Tried Get-VMHost | Get-VMHostStartPolicy | select @{Name="Host";Expression={$_.Name}},Enabled but it didn't worked...
$_ refers to the previous pipe.
In your case the pipe previous to your $_ was Get-VMHostStartPolicy.
If you do a "Get-VMHostStartPolicy (get-vmhost) | Get-Member" you'll see that there is no "Name" property. The name property of the host is "one pipe before" in Get-VMHost.
get-vmhost | select name,@{L="Enabled";e={($_ | Get-VMHostStartPolicy).enabled}}
$_ refers to the previous pipe.
In your case the pipe previous to your $_ was Get-VMHostStartPolicy.
If you do a "Get-VMHostStartPolicy (get-vmhost) | Get-Member" you'll see that there is no "Name" property. The name property of the host is "one pipe before" in Get-VMHost.
get-vmhost | select name,@{L="Enabled";e={($_ | Get-VMHostStartPolicy).enabled}}
Thanks!