2 Replies Latest reply on Oct 10, 2019 8:44 AM by Gidrakos

    in need of a PowerCLI script

    Mallik7 Enthusiast

      I'm in need of a PowerCLI script to get the ESXi host OS version with build number for the required servers (input should be taken from a text file) and

      output to be captured in a .csv file, kindly help...

       

      TIA

        • 1. Re: in need of a PowerCLI script
          LucD Guru
          Community WarriorsUser ModeratorsvExpert

          Try something like this

           

          Get-VMHost -Name (Get-Content -Path .\esxnames.txt) |

          Select Name,Version,Build |

          Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture

          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          • 2. Re: in need of a PowerCLI script
            Gidrakos Hot Shot

            Please and thank you go a long way, but here ya go:

             

            $csvFile = [Path to csv file]

            $hosts = Import-CSV -path $csvFile

            $output = @()

             

            forEach ($line in $hosts) {

                 $hostname = $line.hostname

                 $outPut += (Get-VMHost $hostname | Select-Object name,version, build)

            }

             

            $output | Export-CSV [Path to export file] -force