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

sending email with location of all vms in all vCenters

$
0
0

I have about 8 vCenters that i want to gather information on all vms and send an email telling me what host they are on and what vCenter they live on, here is what i have but man it takes FOREVERRRRR

 

any performance tweaks tips?


$vc = 'AllVMs'

$date = (Get-Date -format u) -replace " ","_" -replace "-","_" -replace ":","_"
$name = "$vc"+"_$date"
$latest = "$vc"+"_Latest"
$vmsonvc = get-vm | select name, @{N="IPAddress"; E={$_.Guest.IPAddress[0]}}, @{N="VMDnsName"; E={$_.ExtensionData.Guest.Hostname}}, NumCPUs,MemoryGBs, Powerstate,VMHost, @{N="vCenter";E={$_.ExtensionData.CLient.ServiceUrl.Split('/')[2]}} | sort name
$vmsonvc | export-csv "C:\WhereAreTheVMs\$name.csv" -NoTypeInformation
sleep 30
$vmsonvc | Export-Csv -Force C:\WhereAreTheVMs\$latest.csv -NoTypeInformation


Viewing all articles
Browse latest Browse all 175326

Trending Articles



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