How to increase speed vm - get get-opinion

Hello

I am new to PowerCLI.

I use the following script to get the VM inventory:

$outputFileVM = "D:\PowerShell_scripts\Inventory.csv".

$VMReport = @)

Get - vm | name sort | %{

$VM = get-view $_.ID

$row = "" | Select-Object VM_Name, VM_Host, VM_Host_Model, VM_Memory, VM_vCpu, VM_CpuLimit, VM_CpuShares

$row. VM_Name = $VM. Config.Name

$row. VM_Host = Get-VMHost - VM $_

$row. VM_Host_Model = Get-VMHost - VM $_. Get-View | % {$_. Hardware.SystemInfo.Model}

$row. VM_Memory = $VM. Config.Hardware.memoryMB

$row. VM_vCpu = $VM. Config.Hardware.numCPU

$row. VM_CpuLimit = $VM. Config.CpuAllocation.Limit

$row. VM_CpuShares = $VM. Config.CpuAllocation.Shares.Shares

$VMReport += $row

}

$VMReport | Export-Csv $outputFileVM - NoTypeInformation

This script runs very slowly. I read something about how to increase the speed by using get - view - viewType. But I do not know how to use for refactory this script.

Can someone help me?

Thank you.

Eduard.

To continue improvements LucD and him do run very fast, make use of get - view "-property" parameter and specify the properties of the VirtualMachine or ESX host that should be retrieved. "." This prevents all the properties that you are not interested in the use of be recovered and accelerating greatly from your code. In other words, replace your call to "Get - VM" with this:

  Get-View -ViewType VirtualMachine -Property Name,Runtime.Host,Config.Hardware,Config.CpuAllocation

because you are only interested in the Name, Runtime.Host, Config.Hardware and Config.CpuAllocation of VirtualMachine properties. Replace your call to "Get-VMHost' in a similar way.

$outputFileVM = 'D:\PowerShell_scripts\Inventory.csv'
$VMReport = @()
Get-View -ViewType VirtualMachine -Property Name,Runtime.Host,Config.Hardware,Config.CpuAllocation | Sort-Object -Property Name | %{
     $row = "" | Select-Object VM_Name, VM_Host, VM_Host_Model, VM_Memory, VM_vCpu, VM_CpuLimit, VM_CpuShares
     $row.VM_Name = $_.Name
     $esx = Get-View $_.Runtime.Host -Property Name,Hardware.SystemInfo.Model
     $row.VM_Host = $esx.Name
     $row.VM_Host_Model = $esx.Hardware.SystemInfo.Model
     $row.VM_Memory = $_.Config.Hardware.memoryMB
     $row.VM_vCpu = $_.Config.Hardware.numCPU
     $row.VM_CpuLimit = $_.Config.CpuAllocation.Limit
     $row.VM_CpuShares = $_.Config.CpuAllocation.Shares.Shares
     $VMReport += $row
}
$VMReport | Export-Csv $outputFileVM -NoTypeInformation

For more details on this, you can go to: http://www.vmdev.info/?p=125

Thank you

Keshav

Tags: VMware

Similar Questions

  • Satellite A665 - how to increase speed WLAN?

    Hello

    I have 2 laptops at home. One is A300 (Windows Vista 32-bit) and the most recent is A665 (Windows 7/64-bit). My wireless router is compatible US Robotics USR 9108 has for both systems.
    The speed of the A300 wireless internet on 8Mbs but A665's speed is of about 0 7Mbs. How to increase the speed of A665? What can cause this?

    Any help would be appretiated.

    Hey Buddy,

    I had a similar problem on my new Satellite A660 and the problem was power saving mode for wireless network card...
    In Windows power management, you can choose different modes for WLAN card to save energy. You must disable (-online High Performance) of energy saving WLAN Card and you will have then the highest possible speed of WLAN.

    This article explains all the functions of energy saving:

  • M30: Connect only with 42.6 K - how to increase speed

    My M30 connect only with 42.6 K speed. I have try all options to increase the speed, but the success. If anyone has the solution, please send me email to [email protected].

    I try the other series on my telephone line and connect them to the speed of 52 to 54K. Desktop even connect at 54K.

    Hello

    Go to Device Manager and choose the modem. Then do a right click and properties.
    You will find many tabs. Please check if the port of Maximum speed in the Modem tab option is set to the highest value.
    In addition, you can check the button in the Advanced tab settings in Advanced Port the controller must also be on the high (max).

    Please check these possibilities.

    Good bye

  • I would like to know how to get a debugger and how to increase the memory on my computer of mocarosoft 7 HP

    I tried to find information on the question of the debugger, but I'm at a total loss about how to increase the memory of the computer.  Please help me, because I have school work on this 'thing'.

    The Windows debugger is included in the SDK

    http://www.Microsoft.com/en-US/Download/details.aspx?displaylang=en&ID=8279

    http://msdn.Microsoft.com/en-us/Windows/hardware/gg463009.aspx

  • Gateway XP is slow, how to increase the speed?

    My husband is using my old gateway with only 37gbs. to get the speed increase I can or should increase the ram with one of these $30... 00 plug-ins, all what he has on the gateway shortcuts website, no photos, music, files, etc., but it is slower, so you can imagine. It is using XP. two computer guys - Ha! says I need more ram and no more memory, they should me these tips that you just unscrew the back of the gateway and connect.

    * original title - will plug into one of these thingys increase speed ram? (adaral did nothing!) *

    Hello

    See the bottom of the articles that might help you improve the performance of the computer.

    Slow PC? Optimize your computer for peak performance
    http://www.Microsoft.com/athome/Setup/optimize.aspx
    How to make a computer faster: 6 ways to speed up your PC
    http://www.Microsoft.com/atwork/maintenance/speed.aspx

  • Find the name of the Cluster to get-opinion

    Hello

    I'm doing a list of cluster names and the number of hosts using get - views, but I can't figure out how I can get the name of the cluster to align the number of hosts.

    I start with this...

    $cluster = get-cluster | Get-opinion

    then I can pull the number of hosts per cluster, using

    $cluster.summary.numhosts

    But it just shows a column of numbers. How can I get the name of the cluster next to it also?

    Thank you

    Scott

    It must write what you are looking for on the screen...

    $clusters = get-Cluster | Get-View

    {foreach ($cluster in $clusters)

    $cluster.name

    $cluster.summary.numhosts

    }

    You should be able to manipulate that to export to a file, if necessary.

  • I unsubscribed from my application only one then it refunded, but how long does take to get to my accounan for me to get my money back

    I bought a computer application don't work well one I unsubscribed from my application one then it refunded, but how long does take to get to my accounan for me to get my money, I have looking for Bowen but I Don t have the refund back on my account

    < re-titled by host >

    Normally apple support sends you an email when a purchase is refunded. Most of the time it will hit your account within 72 hours.

  • How can I do to get the Apple CERT?

    How can I do to get the Apple CERT?

    http://training.Apple.com

  • How to configure iPhone to get an exit "braille display" correct in Chinese, traditional way?

    We realize that somebody helps us to clarify the question of using iPhone (iOS9.3)

    When you use "braille display" under the English mode, the output is correct. However, using "braille display" in Chinese, traditional mode, the result is false. How to configure iPhone to get an exit "braille display" correct in Chinese, traditional way?

    did you ask the developer of the accessory to display braille at the end of the day, they are the only ones who can provide a 100% response

  • How and where I can get firefox 21

    Okay I really get irritated. all I ask is how and where I can get firefox 21. I asked this question a million times, and each answer which I am grateful that they took the time to answer but they all avoid answering my question. It's a simple question. I don't want firefox 22 and anything that anyone says will change that. therefore ask once again: WHERE can I GET the 21 FF? AND HOW CAN I GET IT? I'd be really grateful if someone could answer this question

    If web pages needs to be adjusted after changing this pref or other then you can watch the extension Default FullZoom Level or NoSquint.

    This extension allows to adjust the font size for the user interface:

  • How do I do to get the slide to set up to go to the right and continue? I was up half the night and is not wrong. The only thing that I just did is plugged into the wall outlet and now I'm right back where I had problems. Why keep this product?

    How do I do to get the slide to set up to go to the right and continue? I was up half the night and is not wrong. The only thing that I just did is plugged into the wall outlet and now I'm right back where I had problems. Why keep this product?

    What do you exactly mean by "get the slide to set up go to the right and continue"? Can you give us a little more context and detail?

  • My internet speed is too low. How to increase internet speed?

    I use the broadband internet connection. I check my internet speed.
    My internet speed is too low. How to increase internet speed?

    Message was edited

    Hello

    : D you can not increase the speed of the internet!
    It depends on your internet service provider and only the ISP can increase!
    If you have some problems with the speed of data transfer, I recommend contacting your internet service provider!

    Good bye

  • How do I trouble and get rid of the error Code: rundll32.exe on my MacBook Pro?

    How do I trouble and get rid of the error Code: rundll32.exe on my MacBook Pro?  The heading reads as follows: of "http://Mac support1. com ".  I can't remove it from Safari.  It is also IMMEDIATELY said 'call APPLE to 1-844-335-2242 '.  I asked that this number.  Any help would be greatly appreciated.

    Choose force quit from the Apple menu, close Safari and then run it with the SHIFT key is pressed. If the message reappears, disconnect the computer from the Internet and close the tab Popup came.

    (138334)

  • How to load the CMOS (get the Bios settings) on Lenovo IdeaCentre K330

    Hello

    How to load the CMOS (get the Bios settings) on Lenovo IdeaCentre K330? Found no parameters. I can click on F2, then network and passwords, is this all I could configure?

    OK, I got it - you must click F1 several times when starting system upward!

  • AppStore has disappeared from my iPad 2, iOS 7. How can I download or get it back?

    AppStore has disappeared from my iPad 2, iOS 7. How can I download or get it back?

    Check: Settings - general - Restrictions - installation Apps =?

Maybe you are looking for

  • Failed to download App

    I tried to download a game (Tetris Blitz 2016) and in iTunes it says it downloaded but the app isn't anywhere to be found on my camera.  I have a lot of free memory and downloaded a lot of other applications without any problem.  How can I get it app

  • IMac 10.6.8

    On startup, I get the spinning wheel and the Apple.  When all the (white) blue screen remains. If I hit the F button for iTunes it will come back with the line of menu above.  I can then use the file menu to open recent files and disks, but this is t

  • FCP is really slow.  No background running task.  Ideas?

    FCP is really slow.  No background running task.  Ideas?

  • Printer driver Photosmart p1000 for windows 7

    where can I get a driver for my Photosmart P1000 for Windows 7? Thank you Jack

  • RESEARCH ASSISTANT intermittently returns lowercase FILE names

    When I use the wizard looks very intermittently, FILE names are all returned in LOWERCASE.  The problem with this is that if I open a file from there and then save it.  The file name is converted into tiny all.  I use Windows XP Professional and DID