troubleshooting Question

how do i get this information using vmware powercli?

Avatar of dsopsupport
dsopsupport asked on
1 Comment1 Solution729 ViewsLast Modified:
i have the downloaded a vmware powercli script that returns the total disk used (gb) for each vm and the folder that which the vm is found in virtualcenter.  it also returns the memory assigned and the number of processors.  it works great.  i am a powershell \ scripting novice; can anyone advise the additional code i would need to add for:

also showing templates, not just vm servers
listing the esx host the vm\template is on
indicating how much free space or used space is available for each vm?

and if im putting my wishlist in, also listing the datastore the vmdk files are on for each vmtemplate?

thanks in advance..

$report = @()
Get-VM | foreach-object {
	$row = "" | select FolderName,VMName,MemoryMB,NumCPU,TotalDiskGB,VirtualCenter
	$row.FolderName = (Get-View ($_ | Get-View).Parent).Name
	$row.VMName = $_.Name
	$row.MemoryMb = $_.MemoryMb
	$row.NumCpu = $_.NumCpu
	$_.HardDisks | % {
		$totaldisk = ( $totaldisk + $_.CapacityKB )
	$row.TotalDiskGB = ((( $totaldisk / 1024 ) + $row.MemoryMb ) / 1024 )
	$row.VirtualCenter = $DefaultVIServer.Name
	$report += $row
	$totaldisk = 0
$report |sort -property VMName,FolderName|Export-Csv "c:\vmbyfolder.csv" -noTypeInformation

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros