Solved

Powershell Command for VM's

Posted on 2014-03-13
4
604 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

A procedure for exporting installed hotfix details of remote computers using powershell
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
Teach the user how to use vSphere Update Manager to update the VMware Tools and virtual machine hardware version Open vSphere Client: Review manual processes for updating VMware Tools and virtual hardware versions: Create a new baseline group in vSp…
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…

705 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

21 Experts available now in Live!

Get 1:1 Help Now