Hi,
I've got the two lines of PowerShell script that I use to get some ESXi server information, so I wonder how do I combine these two into the single result in a CSV file ?
Get-VMHost | Get-VMHostNetwork | Select Hostname, DomainName, Name, VMHost, DNSAddress | ft -AutoSize
Get-VMHost | Select Name, Version, Manufacturer, Model | ft -AutoSize
Thanks in advance,
Something like this should work (Note: for some reason PS will throw a syntax error on this one if you don't remove the extra line breaks when you copy and paste from the post):
Get-VMHost | Get-VMHostNetwork |`
Select `
@{N='Host';E={$_.VMHost.Name}},`
@{N='Version';E={$_.VMHost.Version}},`
@{N='Manufacturer';E={$_.VMHost.Manufacturer}},`
@{N='Model';E={$_.VMHost.Model}}, DomainName, Name,`
@{N="DNSAddresses";E={[string]::join(";",($_.DNSAddress))}}|`
Export-Csv c:\vmtntest.csv -NoTypeInformation -UseCulture
Something like this should work (Note: for some reason PS will throw a syntax error on this one if you don't remove the extra line breaks when you copy and paste from the post):
Get-VMHost | Get-VMHostNetwork |`
Select `
@{N='Host';E={$_.VMHost.Name}},`
@{N='Version';E={$_.VMHost.Version}},`
@{N='Manufacturer';E={$_.VMHost.Manufacturer}},`
@{N='Model';E={$_.VMHost.Model}}, DomainName, Name,`
@{N="DNSAddresses";E={[string]::join(";",($_.DNSAddress))}}|`
Export-Csv c:\vmtntest.csv -NoTypeInformation -UseCulture
many thanks, kwhornlcs, it is working as expected and I learn something new too from your script.