Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Powershell Command for VM's

Posted on 2014-03-13
4
Medium Priority
?
640 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Ransomware is a malware that is again in the list of security  concerns. Not only for companies, but also for Government security and  even at personal use. IT departments should be aware and have the right  knowledge to how to fight it.
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
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 …
Teach the user how to join ESXi hosts to Active Directory domains Open vSphere Client: Join ESXi host to AD domain: Verify ESXi computer account in AD: Configure permissions for domain user in ESXi: Test domain user login to ESXi host:

609 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