VMware Cloud Community
Gaprofitt17
Enthusiast
Enthusiast

Import list of VM's, export required data

Hi All,

I'm trying to do something and need some help.  I have a .txt file and or a .csv with a list of VM's..  I'm trying
to import those list of VM's and export the following data from that listing.

Number of vCPU's per server

Configured/allocated memory per server

VMDK storage total (allocated) per server

Looking for some help.

Thanks..

0 Kudos
5 Replies
LucD
Leadership
Leadership

Try like this

Get-VM -Name (Get-Content -Path .\vmnames.txt) |

Select Name,NumCpu,MemoeryGB,ProvisionedSpaceGB,UsedSpaceGB |

Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Gaprofitt17
Enthusiast
Enthusiast

Thanks..  It's weird, it finds some of the VM's but not others..

Get-VM : 9/20/2017 10:56:57 AM    Get-VM   VM with name 'vmxxx' was not found using the specified filter(s).   

At C:\Scripts\pslinfo.ps1:3 char:1

+ Get-VM -Name (Get-Content -Path c:\Scripts\test.txt) |

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo      : ObjectNotFound: (:) [Get-VM], VimException
+ FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM
0 Kudos
LucD
Leadership
Leadership

Looks like you might an entry 'vmxxx' in the test.txt file.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Gaprofitt17
Enthusiast
Enthusiast

Yes, I took out the real name, the real name is in the text file, in the vcenter but I still get the error.  It's the same case, etc.  It's odd

as it exported 1284 entries but i'm still missing about 1000 vm's.

0 Kudos
LucD
Leadership
Leadership

Can you take one of those missing ones, and do a Get-VM -Name vmxxx.

Does that return anything?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos