#Add-PSsnapin VMware.VimAutomation.Core #Initialize-VIToolkitEnvironment.ps1 $item = 'myserver' Connect-VIServer -Server $item -User 'administrator' -Password 'password' $HostReport = @() Get-VMHost | sort-object name | foreach ($_.name){ $Report = "" | select Hostname, Version, Build, Manufacture, Model,Cpu_num, Core_num, Ip_Address,Vmotion_IP $Report.Hostname = $_.Name $Report.Version =($_| Get-View).Config.Product.Version $Report.Build =($_| Get-View).Config.Product.Build $Report.Manufacture =($_| Get-View).Hardware.SystemInfo.Vendor $Report.Model =($_| Get-View).Hardware.SystemInfo.Model $Report.Cpu_num =($_| Get-View).Hardware.CpuInfo.NumCpuPackages $Report.Core_num =($_| Get-View).Hardware.CpuInfo.NumCpuCores $Report.Ip_Address =($_|Get-VMHostNetwork).ConsoleNic[0].IP $Report.Vmotion_IP =($_|Get-VMHostNetwork).VirtualNic[0].IP $HostReport += $Report } Disconnect-VIServer -Confirm:$False $HostReport | Export-Csv -path HostReport.csv –NoTypeInformation