Hello, Can you suggest a script to get in csv file list of virtual machine, with cpu,memory and disk allocate and in which host they are. Thanks
You mean something like this?
Get-VM |
Select Name,@{N='VMHost';E={$_.VMHost.Name}},
NumCpu,MemoryGB,UsedSpaceGB |
Export-Csv report.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
A simple straight one liner would be like this.
Connect-VIServer 'YourvCenterName'
Get-VM | Export-Csv -path “c:\reports\vminventory.csv” –NoTypeInformation
This will export all information regarding VM into CSV file and you can use filter to exclude information you dont want.
If you are looking for specific information you mentioned, use below command :
Connect-VIServer 'YourvCenterName'
Get-VM | select Name, NumCpu, MemoryGB, HardDisks, Host | Export-Csv -path “c:\reports\vminventory.csv” -NoTypeInformation
Afaik there are no HardDisks nor Host properties anymore on a VirtualMachine object since PowerCLI 5.0.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks a lot for explanation, very useful for newbie like me.
Thanks LucD for correction as always
Yes I checked these properties are depreciated, and its working with :
Get-VM | select Name, NumCpu, MemoryGB, ProvisionedSpaceGB, UsedSpaceGB, VMHost | Export-Csv -path “c:\reports\vminventory.csv” -NoTypeInformation
Whereas :
ProvisionedSpaceGB = Hard disk space allocated as VMDK.
UsedSpaceGB = Actual Space used inside VMDK
Thanks LucD and vijayrana968 for help.