VMware Cloud Community
farkasharry
Hot Shot
Hot Shot
Jump to solution

Need a PowerCLI script for a VM report as Excel

Hi,

Could anyone help me with creating a script to get a monthly scheduled report (as Excel file on a vCenter Server location) that includes following data:

VM Name, HDD size, RAM allocated, Amount of CPU, and 4 Custom Annotations (Key and Value 0-3)

Thanks in advance!

*** If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful! *** vExpert 2019, VCAP-DCA,VCP,MCSE,MCITS and some more...
0 Kudos
1 Solution

Accepted Solutions
Virtualinfra
Commander
Commander
Jump to solution

There is a simple tool called RVtool.. use that its a just a minutes of thing, it will fetch you all the required detial and you save that as excel...

Thanks & Regards Dharshan S VCP 4.0,VTSP 5.0, VCP 5.0

View solution in original post

0 Kudos
3 Replies
Virtualinfra
Commander
Commander
Jump to solution

There is a simple tool called RVtool.. use that its a just a minutes of thing, it will fetch you all the required detial and you save that as excel...

Thanks & Regards Dharshan S VCP 4.0,VTSP 5.0, VCP 5.0
0 Kudos
farkasharry
Hot Shot
Hot Shot
Jump to solution

Great tool, that is all I wanted! Thanks

*** If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful! *** vExpert 2019, VCAP-DCA,VCP,MCSE,MCITS and some more...
0 Kudos
vlife201110141
Enthusiast
Enthusiast
Jump to solution

##################

# VM information #

##################

$Report= @()

connect-VIServer -server xxx -user "xxx" -password "xxx"

$vmguest = Get-VM | Get-VMguest | where {$_.State -eq "Running"}

foreach($vm in $vmguest){

     foreach($disk in $vm.disks){

     $report += Select-Object -InputObject $vm, $disk -Property @{N="VMName";E={$vm.vmname}},

                                   @{N="Path";E={$disk.path}},

                                   @{N="CapacityGB";E={[math]::Round(($disk.Capacity)/1GB)}},

                                   @{N="FreespaceGB";E={[math]::Round(($disk.FreeSpace)/1GB)}},

                                   @{N="MemoryMB";E={$vm.vm.memorymb}},

                                   @{N="NumCPU";E={$vm.vm.numcpu}}

}}

$report | Export-Csv "C:\vmreport.csv" -NoTypeInformation -UseCulture

Disconnect-VIServer -Server xxx -Confirm:$false

$report | Export-Csv "C:\vmreport.csv" -NoTypeInformation -UseCulture

Disconnect-VIServer -Server xxx -Confirm:$false

$report | Export-Csv "C:\vmreport.csv" -NoTypeInformation -UseCulture

Disconnect-VIServer -Server xxx -Confirm:$false

0 Kudos