Need to adjust/reconfiure/tune resouces of cluster of virtual machines by entry into xls file

Hi all

I need to adjust the resources of the cluster of virtual machines by entry in the xls file, the files are

VCPU configured, recommended vCPU virtual machine, CPU requires memory (%), memory configured, Recommended recommended

for example, the values are:-

Virtual machineVCPU configuredVCPU recommendedCPU application Recommended (%)Memory configuredMemory recommended
ABC10 vCPUs4 vCPUs77%40 GB16 GB

Then I have to stop the virtual machines and then adjust the values, and then bring the virtual machine. Can someone help me a script for this.

Make sure that your csv file format is attached.

Import-Csv c:\temp\test.csv | {foreach}

Get - VM $_. VirtualMachine. Stop-VMGuest-confirm: $false | Out-Null

do

{

Write-Verbose 'VM stops. "

Start-Sleep - seconds 15

}

While ($_.powerstate - eq "Poweredoff")

Get-VM-name _.virtualMachine $ | Set-VM - NumCpu $_. RecommendedvCPU - MemoryGB $_. RecommendedMemory-confirm: $false

Start-VM VM-$_.virtualMachine

}

Tags: VMware

Similar Questions

  • Need a script to disable the copy/paste in virtual machines

    Need a script to disable the copy/paste in virtual machines

    =================

    Begin {}

    $disableCopy = "isolation.tools.copy.enable".
    $disableCopy_value = "false".
    $disablePaste = "isolation.tools.paste.enable".
    $disablePaste_value = "false".
    $disableGUI = "isolation.tools.setGUIOptions.enable".
    $disableGUI_value = "false".
    }

    {In process
    #Make of course, it's a virtual machine
    If ($_ - isnot [VMware.VimAutomation.Client20.VirtualMachineImpl]) {co continue}

    #Setup our object
    $vm = get-view $_. ID
    $vmConfigSpec = new-Object VMware.Vim.VirtualMachineConfigSpec
    $vmConfigSpec.extraconfig += new-Object VMware.Vim.optionvalue
    $vmConfigSpec.extraconfig += new-Object VMware.Vim.optionvalue
    $vmConfigSpec.extraconfig += new-Object VMware.Vim.optionvalue
    $vmConfigSpec.extraconfig [0]. Key = $disableCopy
    $vmConfigSpec.extraconfig [0]. Value = $disableCopy_value
    $vmConfigSpec.extraconfig [1]. Key = $disablePaste
    $vmConfigSpec.extraconfig [1]. Value = $disablePaste_value
    $vmConfigSpec.extraconfig [2]. Key = $disableGUI
    $vmConfigSpec.extraconfig [2]. Value = $disableGUI_value
    #Run change
    $vm. ReconfigVM ($vmConfigSpec)
    }

    =================

    The script above did not work. This script must run on VMs specified in a cluster that is mentioned.

    As long as vmhgfs is not installed in your virtual machines during the installation of the tools in 5.0, copy and paste between virtual machines is not enabled by default

  • Script to list all the warehouses of data in a cluster, the virtual machines on the data store and the host of the virtual machine is on

    We have warehouses of data which are seen by more than one cluster. I need a script that will display:

    all stores of data seen by a cluster

    the virtual machines on the data store

    the host of the virtual machine is on

    the cluster the host is in

    The output I want is

    name of the store of data, the VM name, host name, the name of the Cluster

    any help would be appreciated

    Pretty sure this will do what you need:

    $report = @()
    Foreach($cluster in Get-Cluster){
        $datastores = $cluster | Get-VMHost | Get-Datastore
        foreach($datastore in $datastores){
        $vms = $datastore | Get-VM
        If ($vms.count -ge 1){
            foreach($VM in $vms){
            $object = New-Object -TypeName PSObject -Property @{
                  Datastore = $datastore.Name
                  VM = $VM.Name
                  HostName = $VM.VMhost
                  Cluster = $cluster
                }
            $report += $object
            }
    
        }
        }
    }
    $report | Export-Csv C:\Temp\VMs.csv -NoTypeInformation -UseCulture
    

    If you only want to shared data warehouses you can then use

    $datastores = $cluster | Get-VMHost | Get-Datastore | Where {$_.Extensiondata.Summary.MultipleHostAccess -eq $True}
    

    Hope this helps

  • New to vCO. Trying to figure out which cluster a virtual machine lives in

    Hello.


    I created a simple 'Hello' workflow VM in vCO and added to vcenter so that it appears in the right click menu of a virtual machine.


    When I run it, the entrance is pre-populated with the name of the virtual machine just as I expected.


    In the Scripting section, I am just running


    System.log ('Hello', + vm.displayName);

    System.log (' VM ID: "+ vm.id");

    I'm trying to figure out how I can get the cluster who lives this virtual machine, but the property is not part of the VC:VirtualMachine.

    I have to take advantage of another type of entry to obtain data or another workflow to get this information?

    Thank you.

    My bad. I didn't know this when I tried first.

    https://communities.VMware.com/thread/464671

    I'll try that. Thank you!

  • Cluster VI3 and vSphere Cluster (migrate virtual machines)

    I have a VI3 and vSphere cluster.  Could I just drag-and - drop my virtual machines to the new Cluster or do I have to upgrade the virtual machines ' hardware of the v4 to v7?

    Thanks in advance

    1. you don't have to upgrade the virtual machine hardware, it is optional.

    2. you do not have to create new cluster, simply upgrade existing by-host. Virtual machines with hardware v4 can be VMotion'ed between 3.5 and 4.0 hosts

    ---

    MCSA, MCTS, VCP, VMware vExpert 2009

    http://blog.vadmin.ru

  • Need a script to the list of all the virtual machines in CSV

    I want to record a list of virtual machines from one host in a csv file so that I can add to their return with

    New-VM - VMFilePath $VMXFile - $vmhost $ESXHost - $VMFolder location

    I started with that, but am struggling with the name of the folder of the virtual machine (can be used in New-VM-map)

    Get-VIServer-Server MyServer - protocol https-Force | out-null

    $report = @)

    Get - VM | Get-View | %{

    $row = "" | Select Name, VmPathName, location

    $row. Name = $_. Name

    $row. VmPathName = $_. Config.Files.VmPathName

    # $row. Location = $_. Folder # faced with this line

    $report += $row

    }

    $report

    # How to make this online, don't invite not not the user?

    Disconnect-VIServer-Server MyServer - Force

    Try this, it should give the blue files

    New-VIProperty -Name 'BlueFolderPath' -ObjectType 'VirtualMachine' -Value {    param($vm)
    
        function Get-ParentName {        param($object)
    
            if($object.Folder) {            $blue = Get-ParentName $object.Folder            $name = $object.Folder.Name        }        elseif($object.Parent -and $object.Parent.GetType().Name -like "Folder*") {            $blue = Get-ParentName $object.Parent            $name = $object.Parent.Name        }        elseif($object.ParentFolder){            $blue = Get-ParentName $object.ParentFolder            $name = $object.ParentFolder.Name        }        if("vm","Datacenters" -notcontains $name) {            $blue + "/" + $name        }        else{            $blue        }    }
    
        (Get-ParentName $vm).Remove(0,1)} -Force | Out-Null
    
    Connect-VIServer -Server MyServer -Protocol https -Force | out-null
    
    $report = @()Get-VM  | %{  $row = "" | select Name, VmPathName, Location  $row.Name = $_.Name  $row.VmPathName = $_.ExtensionData.Config.Files.VmPathName  $row.Location = $_.BlueFolderPath  $report += $row}$report
    
    Disconnect-VIServer -Server MyServer -Confirm:$false
    
  • Need help to report on the configurations of the virtual machine using PowerCLI

    Hi guys,.

    I try to shoot down vCenter virtual computer configuration details and am not having much luck with vCPU multicore machines.

    Looking at the lists of VMS in vSphere Client, it offers a column "Number of CPU" basis and does not include any other granularity (i.e. in terms of casings & carrots as opposed to simply 'CPU Count').

    I thought that maybe I have better luck using PowerCLI and essentially, the cmdlet "Get - VM" has the kind of information I'm looking for, but I find that it lacks a bit when it comes to vCPU details.  Essentially, it turns out that does not do much better than the list of virtual machines in vSphere Client because it produces only a "CPU Num" value, which is not particularly useful.

    For example, if "processors Num" 4, that '4' means?  This could mean one of the following:

    • 1 x 4 drivers
    • Core 2 x 2
    • Basic 4 x 1

    I hope someone out there can help produce me a list of virtual machines with details of configuration that includes both sockets & carrots for vCPU?

    Thanks in advance!

    Try like this

    Get-VM | Select Name, @{N="CPU";E={$_.ExtensionData.Config.hardware.numCPU/$_.ExtensionData.Config.hardware.numCoresPerSocket}}, @{N="Core per CPU";E={$_.ExtensionData.Config.hardware.numCoresPerSocket}}
    
  • Need of dynamic updates on the State of the virtual machine's vMA right for me?

    Hello

    First of all, I want to say vSphere is incredible.

    Second, my goal is the following: to get updates in real time on the CPU usage, disk i/o, and memory on a per-VM basis, not only for an overall ESX Server.  I will send this information to another machine (possibly a virtual computer on the same ESX Server, but not necessarily).

    Is the right tool for me vMA?

    vMA is just a management appliance that manages the vSphere SDK for Perl (which are Perl bindings to the vSphere API)

    I think what you're looking for is what SDK/API you can get this information, it would be the vSphere SDK and the language of choice is to you on if you want to create PowerCLI, vbscript, Perl, .NET, c#, etc. application to monitor and query for this information.

    Take a look at this document to help you get started on the SDK/API: Getting Started with vSphere SDK - Update for SDK 4.1 release

    Also concerning performance monitoring with the vSphere API, take a look at: and on the right there is more literature vSphere API performance analysis

    =========================================================================

    William Lam

    VMware vExpert 2009

    Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

    repository scripts vGhetto

    VMware Code Central - Scripts/code samples for developers and administrators

    150 VMware developer

    Twitter: @lamw

    If you find this information useful, please give points to "correct" or "useful".

  • Hello. I need help developing a PowerCli script that will show me the current configuration of the video Ram of each individual virtual machine on a host\cluster or a vcenter. Can you help me?

    I have a script that will allow me to change the configurations of VRAM, but I need a script that retrieves the configuration of all virtual machines VRAM in my infrastructure.
    I need to get out information to a csv file and run this report on a monthly basis... can you help me?

    Right now my environment is mixed. I have Windows XP virtual machines set to 4 MB, Windows 7 virtual computers set to 8 MB and a subset of sall of virtual machines set to automatic detection of settings.

    I need to be able to recover these settings in a CSV file in order to use this information for comparisons of trdouble-shot performance issues...

    Thank you.

    vram.JPG

    Try something like this

    Get - VM |

    Select Name,

    @{N = "OS"; E={$_. ExtensionData.Config.GuestFullName}},

    @{N = "VideoRamMB"; E = {}

    [math]: Round (($_.)) ExtensionData.Config.Hardware.Device |

    where {$_-is [VMware.Vim.VirtualMachineVideoCard]} |

    (Select VideoRamSizeInKB - ExpandProperty) / 1 Ko, 1).

    }} |

    Export-Csv vm - videoram.csv - NoTypeInformation - UseCulture

  • Get use of the resources of all virtual machines in a cluster

    Hello

    I have developed a measure of capacity management report that collects all the use of the resources of the virtual machines in a datacenter. The function that collects it looks like this:

    def hostMemoryConsumed =]

    def memoryConsumed = 0.0f

    def memoryGranted = 0.0f

    VMs. each() {}

    VM->

    try {}

    memoryConsumed += vm.host.memory.consumed.current.average / 1024.0f<----- how="" to="" do="" this="" to="" get="" from="">

    memoryGranted += vm.host.memory.capacity.current.average / 1024.0f

    }

    {} catch (NullPointerException e)

    }

    VMS is a function of type parameter VMS VMW

    The works above for virtual machines in the data center, but I need it to be after cluster. I can find a cluster of virtual machines, but I'm having trouble with referring to specific values for example consumed memory and capacity.

    If I change the type parameter: VMW Cluster how the metric reference would look like (see the try {})?

    I don't think that a query will help me.

    Thanks in advance

    Erik Alm

    If you want to do for a cluster, you can just get the list of virtual machines in a cluster of first and passing in your script.  If you have a function for a VMWCluster you can add a parameter for "vmwCluster" that is underneath and it should give you a table (topologyObjects) that has all the virtual machines in the cluster.

    QS = server.get ("QueryService") / / query Service

    tquery = qs.createStatement("!) (' VMWVirtualMachine where esxServer.parent.name = "+" ' "+ vmwCluster +" "" ") .setQueryTopologyObjects (true);

    topologyObjects = qs.executeStatement (tquery) .getTopologyObjects)

  • Can I build a HA cluster with no heartbeat of the virtual machine?


    Hello

    I have some virtual firewall on two ESX hosts.

    The firewall running Unix and is not (for the moment) possible for me to install vmware tools.

    Is it possible to create an HA cluster where virtual machines are booted up on another host in the case of a failure of the host?

    Best regards

    Martin

    VMware Tools are only needed if you want to use the control of Virtual Machine in addition to the default host of HA monitoring. For host analysis only (i.e. the computer restarts virtual in the event of a host failure) there is no requirement for VMware Tools.

    André

  • I need to adjust my pop-up blocker. How can I find my toolbar?

    I am trying to install itunes and can not run the program. I think I need to adjust my pop-up blocker, but I can't even find my toolbar

    If you use Internet Explorer, click on the link below:
    http://Windows.Microsoft.com/en-us/Windows-Vista/Internet-Explorer-pop-up-Blocker-frequently-asked-questions

    Thank you

    Marilyn

  • I need to uninstall I-Tunes before the upgrade to Windows 7 and I'm afraid that I do; lose the music library?

    I need to uninstall I-Tunes before the upgrade to Windows 7 and I'm afraid that I do; lose any music library?  I'll be able to download I Tunes and recover my music library >?
    original title: Windows 7 upgrade from VISTA?

    Hi Jrawie,

    If you want to upgrade Windows Vista to Windows 7, you won't lose iTunes music library. However, there is a chance of losing the music of iTunes library if you choose custom installation.

    You can see the Microsoft article for more information on the upgrade:

    Upgrade Windows Vista to Windows 7

    http://Windows.Microsoft.com/en-us/Windows7/help/upgrading-from-Windows-Vista-to-Windows-7

    You can also view the article mentioned for more information:

    Windows 7 Upgrade Advisor

    http://Windows.Microsoft.com/UpgradeAdvisor

    Let us know the results.

  • Error when you try to play a DVD: Windows Media Player cannot play back the video DVD. You may need to adjust your Windows display settings. Open display settings in Control Panel, and then try to lower your screen resolution and color quality settings.

    Windows Media Player help

    I bought a netbook and have an external CD drive to dvd. When I want to play the video, I get this error.  I can't find a solution.  Any Advisor.  Error is... Windows Media Player cannot play back the video DVD. You may need to adjust your Windows display settings. Open display settings in Control Panel, and then try to lower your screen resolution and color quality settings.

    Hi Rains27,
     
    1. were you able to play the same DVD sooner?
    2. must arrive with a particular DVD or all of them?
    3. do you have a DVD decoder installed on your computer?
    4. you use starter edition of windows 7?
    5. What is the resolution on your computer?
    6. have you installed a codec on your computer?
    If you have installed a codec on your computer the I suggest you to uninstall the codec.
     
    Method 1:
    Try running Windows Media Player DVD Troubleshooter utility and check if this may help:
     
    Open the troubleshooting Windows Media Player DVD Troubleshooter by clicking the Start button, then Control Panel. In the search box, type troubleshooting, and then click
     
    Troubleshooting, click View all, and then click Windows Media Player DVD.
    http://Windows.Microsoft.com/en-us/Windows7/open-the-Windows-Media-Player-DVD-Troubleshooter
     
    Method 2:


    Method 3:

    Try to reduce the hardware acceleration again and check if it makes a difference.
     
    a. open the screen resolution by clicking the Start button, Control Panel, and then, under appearance and personalization, click on adjust the screen resolution.
    b. click on advanced settings, troubleshoot tab and then click on change settings.
    c. move the hardware acceleration slider toward none to reduce or turn off video hardware acceleration.
    d. click OK and then click Restart now.

    For more information, see this link: thanks and regards:
    I. Suuresh Kumar - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Windows media player-Windows Media Player cannot play back the video DVD. You may need to adjust your Windows display settings.

    I bougth Windows 7 starter, after the installation, I am unable to read the CD/DVD with media player. These messages continue to flow whenever I have CD/DVD slot...

    "Windows Media Player cannot play DVD video. You may need to adjust your Windows display settings. Open display in Control Panel settings, then trylower your screen resolution and color quality settings"I've adjusted manually, no solution, I had use microsolt auto FIX no way." Please help.

    Windows 7 Starter Edition or Basic... does not include a DVD decoder.

    As you can see in the following article... MS recommends
    upgrade to Windows 7 Home Premium, Ultimate or business.
    More features for you... more money for them...

    Info about DVD decoders: Plug-ins for Windows Media Player
    http://Windows.Microsoft.com/en-us/Windows/downloads/Windows-Media-Player/plug-ins

    It is possible that one of the following freeware
    media players would play your DVD:

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    VLC Media Player
    http://www.videolan.org/

    GOM Media Player
    http://download.CNET.com/GOM-media-player/3000-13632_4-10551786.HTML?tag=mncol;2

    Good luck...

Maybe you are looking for