Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 214415

Re: Listing host information

$
0
0

Ah, I misunderstood.

 

The following line should be added:

@{N="DNS suffixes";E={[string]::Join(",", ($esxcli.network.ip.dns.search.list() | %{$_.DNSSearchDomains}))}}

 

So overall, it will be:

 

$esxi = Get-VMHost -Name "ESXi Name" | Get-View

$esxcli = Get-VMHost -Name "ESXi Name" | Get-EsxCLI

$vmkernel = $esxcli.network.ip.interface.list() | %{$_.Name}

 

$vmk_output = foreach ($vmk in $vmkernel) { $vmk + ":" + ($esxcli.network.ip.interface.ipv4.get($vmk) | %{$_.IPv4Address}) + "/" + ($esxcli.network.ip.interface.ipv4.get($vmk) | %{$_.IPv4Netmask}) }

$vmhost_authentication = Get-VMHostAuthentication -VMHost (Get-VMHost -Name $esxi.Name) | %{$_.Domain}

if ($vmhost_authentication)

{

        $domain = $vmhost_authentication

}

else

{

        $domain = "Null"

}

 

$esxi | Select-Object @{N="ESXi";E={$_.Name}},@{N="CPU";E={$_.Summary.Hardware.CpuModel}},@{N="Memory (GB)";E={$_.Summary.Hardware.MemorySize / 1GB}},@{N="ESXi Version";E={$_.Summary.Config.Product.FullName}},@{N="ESXi Domain";E={$domain}},@{N="VMKernels";E={[string]::Join(",",($vmk_output))}},@{N="DNS Servers";E={[string]::Join(",", ($esxcli.network.ip.dns.server.list() | %{$_.DNSServers}))}},@{N="DNS suffixes";E={[string]::Join(",", ($esxcli.network.ip.dns.search.list() | %{$_.DNSSearchDomains}))}},@{N="SSH Policy";E={$_.Config.Service.Service | Where-Object {$_.Label -match "ssh"} | %{$_.Policy}}},@{N="ESXi Shell Policy";E={$_.Config.Service.Service | Where-Object {$_.Label -match "esxi shell"} | %{$_.Policy}}},@{N="NTP Servers";E={[string]::Join(",", ($_.Config.DateTimeInfo.NtpConfig.Server))}},@{N="Host Profile";E={Get-VMHostProfile -ReferenceHost (Get-VMHost -Name $_.Name) | %{$_.Name}}}



Viewing all articles
Browse latest Browse all 214415

Trending Articles