Hi all
I have a small question, I have two lines of code that must recover the ESXi server DNS and Virtual Center.
How can I join?
Get-VMHost | Get-VMHostNetwork | Select Hostname, DNSAddress | Select Hostname, DNSAddress
Get-VMHost | Select-Object Name, @{N='vCenter';E={$_.Uid.Split('@') [1].Split(':')[0]}
Thanks so much.
One way of doing this
Get-VMHost | Select Name,
@{N='vCenter';E={$_.Uid.Split('@')[1].Split(':')[0]}},
@{N='Hostname';E={$script:net = Get-VMHostNetwork -VMHost $_; $script:net.hostname}},
@{N='DNSAddress';E={$script:net.DNSAddress -join '|'}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
One way of doing this
Get-VMHost | Select Name,
@{N='vCenter';E={$_.Uid.Split('@')[1].Split(':')[0]}},
@{N='Hostname';E={$script:net = Get-VMHostNetwork -VMHost $_; $script:net.hostname}},
@{N='DNSAddress';E={$script:net.DNSAddress -join '|'}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you so much for your support, but I have one more question. How can I put before the VC and then other Host ?
You mean like this?
Get-VMHost | Select @{N='vCenter';E={$_.Uid.Split('@')[1].Split(':')[0]}},
Name,
@{N='Hostname';E={$script:net = Get-VMHostNetwork -VMHost $_; $script:net.hostname}},
@{N='DNSAddress';E={$script:net.DNSAddress -join '|'}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference