Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 179681

Simple VM Report

$
0
0

For some reason this script is only reporting on the last vm in the csv.  Most likely my incorrect use of the first "foreach".  Any help would be appreciated.

 

$curvc = read-host -prompt "Enter VC Name"
connect-viserver -server $curvc

$vms = Import-CSV .\name_dev.csv

foreach ($vm in $vms) {Get-VM $vm.Name |
  foreach {
    $Report = "" | Select-Object -property Name,NumCpu,MemoryMB,Host
    $Report.Name = $_.Name
    $Report.NumCpu = $_.NumCpu
    $Report.MemoryMB = $_.MemoryMB
    $Report.Host = $_.VMHost
  Write-Output $Report
  } | Export-Csv ".\VM.csv"
}
disconnect-viserver * -confirm:$false


Viewing all articles
Browse latest Browse all 179681

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>