?
Solved

Powershell Command for VM's

Posted on 2014-03-13
4
Medium Priority
?
632 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 13

Assisted Solution

by:Abhilash
Abhilash earned 1000 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 19

Accepted Solution

by:
Raheman M. Abdul earned 1000 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Giving access to ESXi shell console is always an issue for IT departments to other Teams, or Projects. We need to find a way so that teams can use ESXTOP for their POCs, or tests without giving them the access to ESXi host shell console with a root …
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
This Micro Tutorial walks you through using a remote console to access a server and install ESXi 5.1. This example is showing remote access and installation using a Dell server. The hypervisor is the very first component of your virtual infrastructu…
This video shows you how easy it is to boot from ISO images for virtual machines with the ISO images stored on a local datastore on the ESXi host.
Suggested Courses

770 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