Solved

Powershell Command for VM's

Posted on 2014-03-13
4
610 Views
Last Modified: 2014-03-26
HI Guys,

I need a powershell, power cli command to find out the cpu quatity and the core settings for every VM in my environment, I then need this data to be outputted to an excel spreadsheet, how can I do this?

Thank you in advance,

Kay
0
Comment
Question by:Kay
  • 2
4 Comments
 
LVL 13

Assisted Solution

by:Abhilash
Abhilash earned 250 total points
ID: 39926387
Its a easy task. You need powercli installed on a machine from where you can connect to your ESXi/vCenter. Open PowerCli and run the ConnectVI-Server cmdlet and connect to your ESXi/vCenter server.

Run the command :  Get-VM | Out-File C:\Report.csv
0
 

Assisted Solution

by:Kay
Kay earned 0 total points
ID: 39926453
I have got this code which works

Get-VM dev* | Select Name,
  @{N="CPU Sockets";E={$_.ExtensionData.Config.Hardware.NumCPU}},
  @{N="Cores per Socket";E={$_.ExtensionData.Config.Hardware.NumCoresPerSocket}} | Out-File -FilePath c:\users\kelly\vms.xls

Open in new window



however I need the datacentre name and I need them to be in separate cells in excel, please help!

right now in the excel spread sheet everything comes up in a single cell
0
 
LVL 18

Accepted Solution

by:
Raheman M. Abdul earned 250 total points
ID: 39930507
Download the function export-xls from tech gallery and it would be much easier for you.
http://gallery.technet.microsoft.com/office/d41565f1-37ef-43cb-9462-a08cd5a610e2

#=========================
# export-xls definition goes here
#then the following code:
Get-VM dev* | Select Name,
  @{N="CPU Sockets";E={$_.ExtensionData.Config.Hardware.NumCPU}},
  @{N="Cores per Socket";E={$_.ExtensionData.Config.Hardware.NumCoresPerSocket}} | export-xls -FilePath c:\users\kelly\vms.xls -NoTypeInformation
0
 

Author Closing Comment

by:Kay
ID: 39955453
that's the best solution.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If we need to check who deleted a Virtual Machine from our vCenter. Looking this task in logs can be painful and spend lot of time, so the best way to check this is in the vCenter DB. Just connect to vCenter DB(default DB should be VCDB and using…
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
Teach the user how to configure vSphere clusters to support the VMware FT feature Open vSphere Web Client: Verify vSphere HA is enabled: Verify netowrking for vMotion and FT Logging is in place or create it: Turn On FT for a virtual machine: Verify …
In this video tutorial I show you the main steps to install and configure  a VMware ESXi6.0 server. The video has my comments as text on the screen and you can pause anytime when needed. Hope this will be helpful. Verify that your hardware and BIO…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now