Script to collect resources cluster HA

Hello

I need a powercli script which collect the following:

By HA-cluster:

An overview of the ESX servers

Each ESX Server:

An overview of shared data warehouses and size, total cpu and total memory.

How to combine the following cmdlets?

Get-cluster 'cluster ' | Get-VMHost | Select name, CPUTotalMHz, MemoryTotalMB

Get-cluster 'cluster ' | Get-vmhost | Get-Datastore. Select name, CapacityMB

Hi Vincent,.

I am pleased that you fixed. And thanks for the link. I didn't know this trick.

Best regards, Robert

Tags: VMware

Similar Questions

  • Need powershell scripts to collect information from vm disk

    Hello

    I need two scripts to collect information from vm drive,

    1 script to collect information vm disk mode

    Expected results:

    The virtual computer name. Name of ESX. Cluster name | VMDK name | Device label. disksizeInGB | diskmode

    Disc-> Just need the info as persistent or independent_persistent mode

    2. script to collect info RDM of Vm

    Expected results:

    The virtual computer name. Name of ESX. Cluster name | DeviceName | File name | Compatibility mode | Size

    The first script

    Get-VM | %{
         $vm = $_
         $vm | Get-HardDisk | %{
              $_ | select @{N="VM";E={$vm.Name}},
                   @{N="ESX";E={$vm.Host}},
                   @{N="Cluster";E={(Get-VMHost $vm.Host | Get-Cluster).Name}},
                   @{N="VMDK";E={$_.Filename}},
                   @{N="Device Label";E={$_.Name}},
                   @{N="disksizeInGB";E={"{0:N1}" -f ($_.CapacityKB/1MB)}},
                   @{N="Diskmode";E={$_.Persistence}}
         }
    } | ft -AutoSize -Force
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • script to collect 'Triggered alarms' 4 VC in a single report

    Hi team,

    I'm looking for a script to collect 'Triggered alarms' 4 VC in a single report. We use ESXi 4.1 worm in the VC.

    Is it possible to collect all 4 VC triggered alarms in a report by acronym and automatically by email with an Excel report.

    Thank you

    Kind regards

    Roze

    Finally the script helped for my need below.

    Hi looking for script to collect multiple vCenters triggered alarms below:

    How to run these scripts: \Get-TriggeredAlarms - vc001, vc002 vc03 vCenters

    Location of the output file: c:\temp\alarms.csv

    Script:

    ______________________________________________________________________________

    (param

    [String []] $vCenters

    )

    Function Get-TriggeredAlarms {}

    (param

    $vCenter = $(throw "doit être spécifié un vCenter."),

    [System.Management.Automation.PSCredential] $credential

    )

    If {($credential)

    $vc = to connect-VIServer $vCenter - Credential $credential

    }

    else {}

    $vc = to connect-VIServer $vCenter

    }

    If (! $vc) {}

    Write-Host "Failure connecting to vCenter $vCenter."

    output

    }

    $rootFolder = get-file-server $vc "data centers".

    {foreach ($ta in $rootFolder.ExtensionData.TriggeredAlarmState)}

    $alarm = "" | Select-Object VC, EntityType, alarm, entity, status, time, recognized, AckBy, AckTime

    $alarm. VC = $vCenter

    $alarm. Alarm = (Get-View-Server $vc $ta.) Alarm). Info.Name

    $entity = get-view-server $vc $ta. Entity

    $alarm. Entity = (Get-View-Server $vc $ta.) Entity). Name

    $alarm. EntityType = (Get-View-Server $vc $ta.) Entity). GetType(). Name

    $alarm. Status = $ta. OverallStatus

    $alarm. Time = $ta. Time

    $alarm. Recognized = $ta. Recognized

    $alarm. AckBy = $ta. AcknowledgedByUser

    $alarm. AckTime = $ta. AcknowledgedTime

    $alarm

    }

    Disconnect-VIServer $vCenter - confirm: $false

    }

    Write-Host ('Get messages from {0}. vCenters' f - $vCenters.Length)

    $alarms = @)

    {foreach ($vCenter to $vCenters)

    Write-Host "Getting alarms from $vCenter."

    $alarms += get-TriggeredAlarms $vCenter

    }

    $alarms | Export-csv c:\temp\alarms.csv

    __________________________________________________________________

  • Need a powershell script to collect info patch esx

    Hello

    IAM looking for a powershell script that collects the result of "motion esxupdate" for all versions of esx host 3.5 in the Virtual center 2.5 version and exports to CSV file.

    It should take input as virtual Center and collect all the information of ESX host, connect to esx hosts, run the esxupdate query and update of the CSV with results.

    I got the code base of other scripts. I've pasted below. He collects only results for esx server in view of the need to modify the code for the above requirements.

    -


    $servers = "server0″", server1″

    $account = "root".

    $password = "password".

    $servers | % {$a = plink - pw $password $account@$_ "esxupdate query"

    {$server = $_}

    -


    Thanks in advance!

    Have you tried running the script in the powershell console?

    May be a problem with the vesi script editor.

    Sent from my iPhone

    On 19 March 2010, at 21:14, Sureshadmin<>

  • Plugin or script to collect books framemaker 10 or 11 with files, fonts, images etc. ?

    I'm looking for a plugin or script to collect books from framemaker 10 or 11 with files, fonts, images etc. ? ("Collect for output" I believe it was called...) I am aware of the plugin by Bruce Foster, but I think that this does not work for these new versions of Framemaker. Can anyone help?

    concerning

    Björn

    Hi again

    I also found this Googling autour:

    http://blogs.Adobe.com/TECHCOMM/2011/07/create-a-book-Packager-using-ExtendScript.html

    Thanks for the answers!

    concerning

    Björn

  • We get an error when I try to collect data from vCenter Server. But the Collection of Cluster works!

    Hello

    I m getting a strange errormessage when he tries to load my vCenter Server inventory.

    I have configured my vCenter Server as the endpoint server and I was able to load the Clusters. When I klick collection of data in a Cluster (Cluster of EQL 1) I can load all the data and the State is 'successful', but when I try to load the inventory FRO the vCenter Server (to get the models) im getting this error message:

    The treatment [inventory], error details error: illegal managed object reference type, folder.

    The same schows Agent logs:

    [26.08.2014 16:48:16] [Info]: start: treatment Workitem ID [2e38598e-4385-4b2d-bc88-fd2b773d1f98] [inventory]

    [26.08.2014 16:48:16] [Debug]: [[inventory]] [inventory] VirtualMachine.Admin.Hostname = vCenter

    [26.08.2014 16:48:16] [Debug]: [[inventory]] VirtualMachine.Admin.ParentIdentity = [inventory]

    [26.08.2014 16:48:16] [Debug]: [[inventory]] [inventory] VirtualMachine.ManagementEndpoint.Name = vCenter

    [26.08.2014 16:48:16] [Debug]: [[inventory]] VirtualMachine.ManagementEndpoint.Identity = [inventory]

    [26.08.2014 16:48:16] [Debug]: [[inventory]] [inventory] VirtualMachine.ManagementEndpoint.Endpoint0 = vCenter

    [26.08.2014 16:48:16] [Debug]: [[inventory]] [inventory] VirtualMachine.Admin.Name = inventory

    [26.08.2014 16:48:16] [Error]: <? XML version = "1.0" encoding = "utf-16"? >

    < Boolean > false < / Boolean >

    Error parsing [inventory], details of the error:

    System.ArgumentException: Illegal managed object reference type, folder.

    at DynamicOps.Vrm.Agent.vSphere.VSphereGetHostsRequest.ExecuteImpl)

    at DynamicOps.Vrm.Agent.vSphere.VSphereHypervisorServiceProvider.GetHosts (ManagementEndpoint managementEndpoint)

    to DynamicOps.Vrm.Agent.Collector'3.get_Hosts)

    to DynamicOps.Vrm.Agent.Collector'3.CollectManagementEndpoints)

    to DynamicOps.Vrm.Agent.CollectInventory'3.Collect)

    to DynamicOps.Vrm.Agent.BaseHypervisorAgent'3.EnumerateHypervisorResources (collector collector 3, WorkItem workItem, PropertyBagHelper propertyBagHelper)

    to DynamicOps.Vrm.Agent.BaseHypervisorAgent'3.ProcessWorkitem (WorkItem workItem, task of the chain, PropertyBagHelper propertyBag)

    to DynamicOps.Vrm.Agent.vSphere.VSphereAgentService.ProcessWorkitem (WorkItem workItem, task of the chain, PropertyBagHelper propertyBag)

    to DynamicOps.Vrm.Agent.BaseAgent.ProcessWorkitem (WorkItem workItem)

    I hope that someone had an idea, im out of ideas.

    THX Steven

    There is no data for the endpoint collection... And I'm not entirely sure of how you added the vCenter object it... y at - it a calculation object named "vCenter? To answer your specific questions about the models, however, they must be stored on a cluster that is part of the tissue group for data collection to pick them up... They are not considered as a global entity (as a resource calculation). Add models to one of the clusters and then to collect data on it, and you should be fine.

  • CPU script data collection - need help optimizing.

    Hello

    There is a follow-up on this topic:

    http://communities.VMware.com/message/2192431

    The script requires 3 Powershell and PowerCLI v5.1 Release 2.

    Also the advice from here has been used:

    http://vnugglets.com/2011/11/speed-up-first-PowerCLI-5-cmdlet.html

    , The script connects to the x number of guests at the same time, gathers Intel cpu for the hosts and virtual machines and records them in csv files. This, it is the amount of time $counter, the Start-Sleep-s 10 is the less frequent verification.

    Is there something I could remove or replace to make it less heavy resources? Please offer suggestions.
    I know that $metrics is currently
    useless

    $Hosts = @(
    "xx.xx.xx.1",
    "xx.xx.xx.2",
    "xx.xx.xx.3")
    $metrics = "cpu.usage.average"
    $counter = 5
     
    foreach ($Server in $Hosts){
         Start-Job -ScriptBlock { 
              param ($Server, $metrics, $counter)
              Add-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue
              Connect-VIServer -Server $Server -user xxx -password "xxx" | Out-Null
              $vms = Get-Vm -Server $Server | where {$_.PowerState -eq "PoweredOn"}
     
              for ($i=0; $i -lt $counter; $i++){
                   $alldata = @()
                   $stats = Get-Stat -Entity $Server -Realtime -Stat $metrics -MaxSamples 1
                   $stats | Group-Object -Property Entity | %{
                        $hoststat = "" | Select Date, HostName, VMName, CPUAvg
                        $hoststat.Date =Get-date
                        $hoststat.HostName = $_.name
                        $cpu = $_.Group | where {$_.MetricId -eq "cpu.usage.average"} | Measure-Object -Property value -Average
                        $hoststat.CPUAvg = [int]$cpu.Average
                        $hostname = $hoststat.HostName
                        $alldata += $hoststat
                   }
     
                   $stats = Get-Stat -Entity $vms -Realtime -Stat $metrics -MaxSamples 1 
                   $stats | Group-Object -Property Entity | %{
                        $vmstat = "" | Select Date, HostName, VmName, CPUAvg
                        $vmstat.Date = Get-date 
                        $vmstat.VmName = $_.name
                        $cpu = $_.Group | where {$_.MetricId -eq "cpu.usage.average"} | Measure-Object -Property value -Average
                        $vmstat.CPUAvg = [int]$cpu.Average
                        $vmstat.HostName = $hostname
                        $alldata += $vmstat
                   }
                   $alldata | Export-Csv "c:\tmp\$Server.csv" -Append -noTypeInformation
                   Clear-Variable -Name alldata
                   Start-Sleep -s 10
              }
              Disconnect-VIServer * -Force -Confirm:$false
         } -ArgumentList ($Server, $metrics, $counter)
    }
     
    
    
    

    Concerning

    Sponge cake

    You can avoid the CSV file by using the Out-DataTable and functions of writing-DataTable .

    Which also avoids having to use the LogParser utility.

    Something like this should do the trick.

    $dt = $alldata | Out-DataTable Write-DataTable -ServerInstance "localhost" -Database "CPUStats" -TableName "CPUusage" -Data $dt
    

    Note that this will not add to the data in table CPUusage .

    A possible solution is to read data from SQL before collecting the new metric values.

  • Script to collect information on an instance of rac oracle / Linux area normal conclusion?

    Hi all
    I have been instructed by the disaster recovery team to get a small quick script of race, to see what oracle instances are in a box, if it is raised, listener is running, etc.

    Normal, only one node instances so far, I've had success. I retrieve the data from the file/etc/oratab and parse try it with awk to get an ORACLE_SID and ORACLE_HOME and.

    This script is run as a user to the dba group, or the oracle so that each instance I try login through SQL * more than connect / as sysdba and not a request to collect information for instance that I echo the screen to determine that the instance is high and connectable.

    The problem I encountered, if there is an instance listed for a node in a RAC cluster... he can't see/etc/oratab entries are quite the same using dbca for RAC nodes as normal nodes.

    For example, say I have a RAC cluster that rac3 and rac1 rac2 nodes.

    From what I see... on the individual nodes, in the/etc/oratab entries only seem to put in for the cluster CCR, rather that say rac1. My script that tries to set the oracle sid and home and connect / as sysdba fails. If the entry has been made there as rac1, it should work, I think.

    Can anyone make any suggestions for me to use with this script, so that I can know which instance of node is running, if CARS is located on the computer... and automatically find and connect similar to how I am doing with the unique databases using/etc/oratab

    Is there a similar to/etc/oratab file that is used by the clusterware on the system?

    Thanks in advance,

    Cayenne

    Published by: cayenne on April 15, 2009 12:57

    Why don't doing by pmon... which I think does not work if she is down but up... you can just run something like:

    ps - ef | grep - v grep | grep pmon | cut '_' f d 3

    or... you could use the oracle_sid you get from oratab (dbname in this case... for example) and run the following:

    srvctl status database-d $sid_from_oratab | grep 'hostname ' | AWK '{print $2} '.

  • Using the script to collect data

    Hello

    I would use the new script feature to collect a metric.

    I see that the script must return a value as the key value:

    This is my script:

    #! / bin/bash

    Val = $(netstat-ntaupe | grep httpd | grep ESTABLISHED | wc-l)

    echo "res = $val.

    The script returns a result as:

    RES = 18

    But the measure of value of return in my script object result is always 0

    I see that the script is run, but of all tha.

    Something I missed here?

    Thans

    Got a response, it is only because netstat must be root and scripts are run as user epops.

    That's all

  • Script to collect data from several vcentres

    Hi all

    I have a few vCentres (5.5 and 5.1) I want to set up a scheduled task to collect some personal information and send me a csv file every 1st of the month.

    First, I test on 2 x vcentres only collection esxi hosts (the info that I need are different, but once I get the job of script I can change what I need).

    I have configure something like:

    $user = "domain\username".

    $pass = "user password"

    $vcentres = "IP1, IP2.

    ForEach ($vcentre to $vcentres)

    {

    $filedate = get-date - uformat ' %d-%m - Y % - hour %M ' %S

    $filename = "c:\tmp\reports\" + $vcentre + "_" + $filedate ".csv".

    Write-Host "connection to" $vcentre

    SE connect-viserver-Server $vcentre - user $user-password $pass

    Get-vmhost | Select name. Export-CSV $filename - NoType - UseCulture

    }

    Disconnect-viserver-Server *-confirm: $false

    I expected to receive 2 x csv files, one for each IP vcentre address, i.e., c:\tmp\IP1_date_time.csv and c:\tmp\IP2_date_time.csv

    Script runs the file but does not generate only 1 x csv with all inside esxi hosts.

    I think I need to install another variable to store the csv file when the first pass of the loop, then the second and finally to save to the specified location.

    Could anyone advice what I am doing wrong?

    Thanks to anticiaption.

    Try to make the VIServer disconnection in the foreach loop.

  • Request to modify the script to collect the CPU Ready in percentage by VM instead of milliseconds

    Hi all

    I would ask for help here with the script that I found in this forum by Mr. LucD to collect % VM CPU ready to be changed according to the famous formula for calculating the percentage of CPU of VM ready:

    ((Valeur de sommation UC / (< intervalle de mise à jour par défaut graphique en secondes > * 1000)) * 100) / number of vCPU = CPU % ready



    From my understanding, the script must be changed because:

    1. Don't divide the percentage CPU Ready by the number of vCPU for each virtual computer
    2. The refresh interval is not set 'for a week. for simplicity, this script will be used to collect last week performance data ($start = (Get-Date). AddDays(-7))

    Note: The refresh rate can be found this KB: VMware KB: conversion between the summation of values CPU and CPU ready %

    the purpose of this script is to classify VM of the result is greater than 10% determined as having problems with CPU Ready. Article source: http://docs.media.bitpipe.com/io_10x/io_107330/item_605784/Basic%20VMware%20vSphere%20Performance%20Guide_201211.pdf)

    I have tested and run script below:

    $allvms = @()
    $vms = Get-VM  
    $start = (Get-Date).AddDays(-7)
    $metrics = "cpu.usage.average","mem.usage.average","cpu.ready.summation" 
    
    
    Get-Stat -Entity $vms -Start $start -Stat $metrics | 
    Group-Object -Property {$_.Entity.Name} | %{
      $cpu = $_.Group | where {$_.MetricId -eq "cpu.usage.average" -and $_.Instance -eq ""} | Measure-Object -Property value -Average -Maximum -Minimum
      $mem = $_.Group | where {$_.MetricId -eq "mem.usage.average"} | Measure-Object -Property value -Average -Maximum -Minimum
      $vmstat = "" | Select Time,VmName, MemMax, MemAvg, MemMin, CPUMax, CPUAvg, CPUMin, CPURDYMaxPercent
      $vmstat.VmName = $_.Group[0].Entity.Name
      $vmstat.Time = $_.Group | Sort-Object -Property Timestamp | Select -First 1 | Select -ExpandProperty Timestamp
      $vmstat.CPUMax = [Math]::Round($cpu.Maximum,2)
      $vmstat.CPUAvg = [Math]::Round($cpu.Average,2)
      $vmstat.CPUMin = [Math]::Round($cpu.Minimum,2)
      $vmstat.MemMax = [Math]::Round($mem.Maximum,2)
      $vmstat.MemAvg = [Math]::Round($mem.Average,2)
      $vmstat.MemMin = [Math]::Round($mem.Minimum,2)
      $vmstat.CPURDYMaxPercent = &{
      $interval = $_.Group[0].IntervalSecs * 10
        ($_.Group | where {$_.MetricId -eq "cpu.ready.summation" -and $_.Instance -eq ""} | 
      Sort-Object -Property Value -Descending |
        Select -First 1 | 
        Select -ExpandProperty Value) / $interval
      }
      $allvms += $vmstat
    }
    $allvms | Select Time,VMName, MemMax, MemAvg, MemMin, CPUMax, CPUAvg, CPUMin, CPURDYMaxPercent | 
    Export-Csv "C:\TEMP\AllVMs-7days.csv" -noTypeInformation -UseCulture 
    

    I hope that this will be the most useful script to understand where particular VM is experiencing problem with percentage CPU Ready.

    Thanks in advance,

    I have my version here, I use to use of the CPU.

    {Function Get-Ready

    <>

    . LOGBOOK

    This unique feature provide several reports and information. IE: convert ready value into a readable format (for real-time, day, week, month, year).

    . DESCRIPTION

    This unique feature provides multiple information of esxi host, as the list below.

    The CPU usage of the virtual, Mhz, the use of the processor CPU ready computer

    vCPU allocated to the VM (jailbroken in the casings and core)

    VMHost name

    Information physical VMhost CPU (jailbroken in the casings and core)

    To convert between value of CPU ready summons in vCenter performance tables and the value of loan % of CPU that you see in esxtop, you must use a formula.

    The form requires that you know the default update intervals for performance dashboards. These are the default update for each chart intervals:

    Realtime: 20 seconds

    Last day: 5 minutes (300 seconds)

    Last week: 30 minutes (1800 seconds)

    Over the past month: 2 hours (7200 seconds)

    Last year: 1 day (86400 seconds)

    To calculate the % of CPU ready of the summation value ready CPU, use this formula:

    (Value of summons UC / ( * 1000)) * 100 = ready % CPU

    Example: Stats in real-time for a VM on vCenter may have an average CPU ready summation value of 1000. Use the appropriate formula values to get the loan % of CPU.

    (1000 / (20 sec * 1000)) * 100 = 5% CPU ready

    For more information on vmware 2002181 KB

    . VM PARAMETER

    Name of the virtual machine

    . ENTRIES

    String.System.Management.Automation.PSObject.

    . OUTPUTS

    None.

    . EXAMPLE OF

    If you wrap this script inside the function you can use it as a command.

    To encapsulate this script

    PS > Get-VMHost esxihost.fqdn | Get ready

    Report back for perticular VMHost vm

    . NOTES

    To view examples, type: "get-help Set-VMHostSSH-examples.

    For more information, type: "get-help Set-VMHostSSH-detailed".

    For technical information, type: "get-help Set-VMHostSSH-full".

    http://kunaludapi.blogspot.com

    #>

    [CmdletBinding()]

    (param

    [Parameter (Mandatory = $true, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $true)]

    ([String] $Name) #param

    BEGIN {#begin}

    {in process

    $Stattypes = "cpu.usage.average", "cpu.usagemhz.average", "cpu.ready.summation".

    foreach ($esxi in $(Get-VMHost $Name)) {}

    $vmlist = $esxi | Get - VM | Where-Object {$_.} PowerState - eq "Receptor"}

    $esxiCPUSockets = $esxi. ExtensionData.Summary.Hardware.NumCpuPkgs

    $esxiCPUcores = $esxi. ExtensionData.Summary.Hardware.NumCpuCores/$esxiCPUSockets

    $TotalesxiCPUs = $esxiCPUSockets * $esxiCPUcores

    {foreach ($vm to $vmlist)

    $VMCPUNumCpu = $vm. NumCpu

    $VMCPUCores = $vm. ExtensionData.config.hardware.NumCoresPerSocket

    $VMCPUSockets = $VMCPUNumCpu / $VMCPUCores

    $GroupedRealTimestats = get-Stat-entity $vm - $Stattypes - Instance-Realtime Stat ' "-ErrorAction SilentlyContinue | MetricId Group-Object

    $RealTimeCPUAverageStat = '{0:N2}' f $($GroupedRealTimestats |) Where {$_.} Name - eq "cpu.usage.average"} | Select-Object - ExpandProperty group | Measure-object-value average | Select - Object - ExpandProperty average)

    $RealTimeCPUUsageMhzStat = '{0:N2}' f $($GroupedRealTimestats |) Where {$_.} Name - eq "cpu.usagemhz.average"} | Select-Object - ExpandProperty group | Measure-object-value average | Select - Object - ExpandProperty average)

    $RealTimeReadystat = $GroupedRealTimestats | Where {$_.} Name - eq "cpu.ready.summation"} | Select-Object - ExpandProperty group | Measure-object-value average | Select-Object - ExpandProperty average

    $RealTimereadyvalue = [math]: tour ($(($RealTimeReadystat / (20 * 1000)) * 100), 2)

    $Groupeddaystats is entity-Stat-get $vm - Stat $Stattypes - beginning (get-date). AddDays(-1)-done (get-date) - IntervalMins 5 - Instance ""-ErrorAction SilentlyContinue | MetricId Group-Object

    $dayCPUAverageStat = '{0:N2}' f $($Groupeddaystats |) Where {$_.} Name - eq "cpu.usage.average"} | Select-Object - ExpandProperty group | Measure-object-value average | Select - Object - ExpandProperty average)

    $dayCPUUsageMhzStat = '{0:N2}' f $($Groupeddaystats |) Where {$_.} Name - eq "cpu.usagemhz.average"} | Select-Object - ExpandProperty group | Measure-object-value average | Select - Object - ExpandProperty average)

    $dayReadystat = $Groupeddaystats | Where {$_.} Name - eq "cpu.ready.summation"} | Select-Object - ExpandProperty group | Measure-object-value average | Select-Object - ExpandProperty average

    $dayreadyvalue = [math]: tour ($(($dayReadystat / (300 * 1000)) * 100), 2)

    $Groupedweekstats is entity-Stat-get $vm - Stat $Stattypes - beginning (get-date). AddDays(-7)-done (get-date) - IntervalMins 30 - Instance ""-ErrorAction SilentlyContinue | MetricId Group-Object

    $weekCPUAverageStat = '{0:N2}' f $($Groupedweekstats |) Where {$_.} Name - eq "cpu.usage.average"} | Select-Object - ExpandProperty group | Measure-object-value average | Select - Object - ExpandProperty average)

    $weekCPUUsageMhzStat = '{0:N2}' f $($Groupedweekstats |) Where {$_.} Name - eq "cpu.usagemhz.average"} | Select-Object - ExpandProperty group | Measure-object-value average | Select - Object - ExpandProperty average)

    $weekReadystat = $Groupedweekstats | Where {$_.} Name - eq "cpu.ready.summation"} | Select-Object - ExpandProperty group | Measure-object-value average | Select-Object - ExpandProperty average

    $weekreadyvalue = [math]: tour ($(($weekReadystat / (1800 * 1000)) * 100), 2)

    $Groupedmonthstats is entity-Stat-get $vm - Stat $Stattypes - beginning (get-date). AddDays(-30)-done (get-date) - IntervalMins 120 - Instance ""-ErrorAction SilentlyContinue | MetricId Group-Object

    $monthCPUAverageStat = '{0:N2}' f $($Groupedmonthstats |) Where {$_.} Name - eq "cpu.usage.average"} | Select-Object - ExpandProperty group | Measure-object-value average | Select - Object - ExpandProperty average)

    $monthCPUUsageMhzStat = '{0:N2}' f $($Groupedmonthstats |) Where {$_.} Name - eq "cpu.usagemhz.average"} | Select-Object - ExpandProperty group | Measure-object-value average | Select - Object - ExpandProperty average)

    $monthReadystat = $Groupedmonthstats | Where {$_.} Name - eq "cpu.ready.summation"} | Select-Object - ExpandProperty group | Measure-object-value average | Select-Object - ExpandProperty average

    $monthreadyvalue = [math]: tour ($(($monthReadystat / (7200 * 1000)) * 100), 2)

    $Groupedyearstats is entity-Stat-get $vm - Stat $Stattypes - beginning (get-date). AddDays(-365)-done (get-date) - IntervalMins 1440 - Instance ""-ErrorAction SilentlyContinue | MetricId Group-Object

    $yearCPUAverageStat = '{0:N2}' f $($Groupedyearstats |) Where {$_.} Name - eq "cpu.usage.average"} | Select-Object - ExpandProperty group | Measure-object-value average | Select - Object - ExpandProperty average)

    $yearCPUUsageMhzStat = '{0:N2}' f $($Groupedyearstats |) Where {$_.} Name - eq "cpu.usagemhz.average"} | Select-Object - ExpandProperty group | Measure-object-value average | Select - Object - ExpandProperty average)

    $yearReadystat = $Groupedyearstats | Where {$_.} Name - eq "cpu.ready.summation"} | Select-Object - ExpandProperty group | Measure-object-value average | Select-Object - ExpandProperty average

    $yearreadyvalue = [math]: tour ($(($yearReadystat / (86400 * 1000)) * 100), 2)

    $data = New-Object psobject

    $data | Add-Member - MemberType NoteProperty-VM name-value $vm.name

    $data | Add-Member - MemberType NoteProperty-name VMTotalCPUs-value $VMCPUNumCpu

    $data | Add-Member - MemberType NoteProperty-name VMTotalCPUSockets-value $VMCPUSockets

    $data | Add-Member - MemberType NoteProperty-name VMTotalCPUCores-value $VMCPUCores

    $data | Add-Member - MemberType NoteProperty-Name ' in time real average usage % "-value $RealTimeCPUAverageStat

    $data | Add-Member - MemberType NoteProperty-name "Mhz real-time use" - value $RealTimeCPUUsageMhzStat

    $data | Add-Member - MemberType NoteProperty-Name "loans in time real %"-value $RealTimereadyvalue

    $data | Add-Member - MemberType NoteProperty-name ' day average use % "-value $dayCPUAverageStat

    $data | Add-Member - MemberType NoteProperty-name of the "day use Mhz"-value $dayCPUUsageMhzStat

    $data | Add-Member - MemberType NoteProperty-Name "ready day %"-value $dayreadyvalue

    $data | Add-Member - MemberType NoteProperty-"week average use name% '-value $weekCPUAverageStat

    $data | Add-Member - MemberType NoteProperty-Name "week use Mhz"-value $weekCPUUsageMhzStat

    $data | Add-Member - MemberType NoteProperty-"week loan name% '-value $weekreadyvalue

    $data | Add-Member - MemberType NoteProperty-' months average use name% '-value $monthCPUAverageStat

    $data | Add-Member - MemberType NoteProperty-Name "month use Mhz"-value $monthCPUUsageMhzStat

    $data | Add-Member - MemberType NoteProperty-' months loan name% '-value $monthreadyvalue

    $data | Add-Member - MemberType NoteProperty-name ' year average use % "-value $yearCPUAverageStat

    $data | Add-Member - MemberType NoteProperty-name ' year use Mhz "-value $yearCPUUsageMhzStat

    $data | Add-Member - MemberType NoteProperty-Name "ready year % '-value $yearreadyvalue

    $data | Add-Member - MemberType NoteProperty - name VMHost-$esxi.name value

    $data | Add-Member - MemberType NoteProperty-name VMHostCPUSockets-value $esxiCPUSockets

    $data | Add-Member - MemberType NoteProperty-name VMHostCPUCores-value $esxiCPUCores

    $data | Add-Member - MemberType NoteProperty-name TotalVMhostCPUs-value $TotalesxiCPUs

    $data

    } #foreach ($vm in $vmlist)

    } #foreach ($esxi in $(Get-VMHost $Name))

    } #process

    } #Function-prepare you

    Get-VMHost | Get ready

  • Script to collect some statistics on hosts and virtual machines

    I'm trying to accomplish to get the following statistics, put into a script.

    When I run this script, it must be run by "vcenter" and result the following items.

    The cluster name / number of hosts / number of computers models and virtual / assigned the total memory of all the virtual machines on the cluster (not what is actually to be in use)

    Thus, for example, in the XYZ group with 4 guests, if I have 20 MV that I have 4 GB of RAM for each virtual machine, the output should be 80 GB

    XYZ 4 20 80 GB

    I suspect that you forgot the Select at the end in order to recover the amount.

    @{N = 'CPU'; E = {}

    Notice-EEG-Id (Get-View-Id $_.) ExtensionData.Host - VM property | %{$_. VM}) - property 'Config.Hardware.NumCPU ' |

    %{$_. Config.Hardware.NumCPU} | Measure-object-sum |  Select - ExpandProperty sum}},

  • Script for the host Cluster Datacenter WWN of output

    Hi all

    I'm looking to create a script to the output:

    WWN with WWP, Datacenter, Cluster, host

    Do not know how to start with this one. I guess I'd start using Get-Data Center and get-content then from there.

    Any help appreciated,

    Rob.

    Rob,

    You can try the following code. It should be a pretty good entry at the very least. I don't have a FC HBA in my lab at home to work out the kinks with the info WWN that will have to wait until tomorrow.

    $vmhosts = get-VMHost

    $HBAInfo = @)

    {Foreach ($vmhost to $vmhosts)

    $HBAs = $vmhost | Get-VMHostHba-type FibreChannel

    $DC = (get-Datacenter - VMHost $vmhost). Name

    $Cluster = (get-Cluster - VMHost $vmhost). Name

    {Foreach ($HBA to $HBAs)

    $Details = "" | Select WWN, Datacenter, Cluster host

    $Details.WWN = $HBA. PortWorldWideName

    $Details.Datacenter = $DC

    $Details.Cluster = $Cluster

    $Details.Host = $vmhost. Name

    $HBAInfo += $Details

    }

    }

    $HBAInfo

  • Y at - it a good script to collect all the layers in 1 layer?

    I am doing something similar to the selection of layers and using collection based on new layer in Illustrator. It runs successfully on several layers, but for others it will expel just ' mistake Illustrator: 1346458189 ("PARM").

    My script is really simple and I use it to collect layers into a layer named "Earned", if it has more than 2 layers. I even tried the fix suggested in this Readme: http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/pdf/illustrator/scripting/Readme.tx t. But I get an error just when you reference a running level. I tried directly referring to the current in the loop layer, but it always causes problems. If I get rid of the line of movement (which is the whole reason for this script), it works fine. I tried to let the script sleep and a few other things, but cannot make it work properly. I've included some debugging lines who write in the console to make sure that everything is properly defined

    var = app.activeDocument actDoc

    var layerCount = actDoc.layers.length;

    $.write("\n//layer Name\nLayer Count:" + layerCount + "\n///").

    var placeInLayer = actDoc.layers ['Collected ""];

    If (layerCount > 0) {}

    for (i = 0; i < layerCount; i ++) {}

    try {var topLayers = actDoc.layers [i] ;}

    catch("|)    "+e) {

    $.write (e)

    }

    .write $("\nLayer name:"+ topLayers.name+"|)    Count: "+ i +" ")".

    Sublayers = topLayers.layers;

    If (topLayers.name == "Collected") continue;

    topLayers.move (placeInLayer, ElementPlacement.PLACEATEND);

    }

    }

    Try a loop back... from the bottom layer.

  • Script to collect the "Master page-text-content of the framework" details

    Hello

    The collection "Masterpage - TextFrame - content" Indesign file details.

    If the spread of the master page text frame, I need to retrieve this text frame content in separate folder. If it possible by Indesign script?

    Thank you

    hasvi

    Hi Hasvi,

    I hope this helps you!

    var doc = app.activeDocument;

    var master = doc.masterSpreads;

    var content = "";

    for (var i = 0; i)<>

    {

    for (var j = 0; j)<>

    {

    If (master [i] .parentPage .textFrames [j]! = null) {}

    content += [i] master .silence .textFrames [j] + "\t" + master [i] .name + "\r";

    }

    }

    }

    var file = new File ("c:/1. txt");

    leader. Open ("w");

    leader. Write (happy);

    leader. Close();

    Kind regards

    Cognet

Maybe you are looking for