Script to check the DRS VM groups?

Hello guys,.

I want to know if you could give me an idea on how to check the DRS of VM groups on my cluster.

DRS group are created with a shared identifier that is common on the VM too. For example: VMS DRS group R125 must include each VM name "R125" is included (such as VM-R125-001).

First of all, I would like to work on a script that will be able to detect if certain VM are not in their groups of DRS corresponding VM (by listing for example) and later add an e-mail notification if possible.

I would like to know if you could give me some advice on how to run this script, what cmdlet should I use, etc.

Thank you very much

Kind regards

Benedict.

EDIT: VM DRS group and not of DRS rules

Try like this

Import-Module DRSRule

#

# Specifications cluster

$cluster1 = "ClusterName".

$cluster = get-Cluster-name $cluster1

#

#for each customer ID.

foreach ($Group in (Get-DrsVMGroup-Cluster $cluster))

{

# Get all the virtual machines that match the groupID

$vms = get-VM-name 'vm-$($Group.Name)-01"- location $cluster | Select name

# Compare 2 results

$result = compare-Object - referenceobject $Group.VM - DifferenceObject $vms

# Display the result

Write-Output "missing DRS rule $([string]: join (($result |))). where {$_.} SideIndicator - eq "=>"} | Select ExpandProperty - InputObject,)' | ')) »

Write-Output "be deleted from the rule DRS $([string]: join (($result |))). where {$_.} SideIndicator - eq '<='} |="" select="" -expandproperty="">

}

Tags: VMware

Similar Questions

  • Using Script to check the version of Adobe Reader software

    Hello. I am now currently using LiveCycle Designer to create a form that allows users to attach attachments. We found that if a user uses Adobe Reader 7.0 or below, there is a problem on fixing attachments. Accordingly, we would like to add a script to check the version of the Adobe Reader client in a ready state of the form. If a user uses Adobe 7.0 or below, the message box opens and suggests the user to download a more recent version of the Adobe Reader software. I would like to know is possible to do so. Thank you very much

    Hello

    the script might look like:

    If (typeof (app.viewerVersion)! = "undefined")

    If (app.viewerVersion<>

    {

    xfa.host.messageBox ("your Version of Adobe Reader is old...");

    }

    }

    You can use it in the docReady:Event of your form to inform users.

  • Apple script to check the part of iTunes XML library with other applications.

    Y at - there no apple for script

    Check "Sharing iTunes library XML with other applications." Of

    • iTunes
    • Preferences
    • Advanced tab...

    I want to read itunes Media Library .xml but lates itunes no xml is created by default,

    so I want this XML created by my application through the apple script.

    iTunes12.4

    https://discussions.apple.com/message/28513383#28513383 - new with the parameter preferably 12.2 iTunes to turn create .xml

    If you really want an AppleScript, I think you should ask on the iTunes for Mac forum, or maybe the OSX Technologies.

  • Change the PowerCLI Script to use the DRS and DRS storage

    Hello

    I have a PowerCLI script that specifies a host and a data store to create a new virtual machine, which has served us well. Now we have activated the DRS and DRS storage and I wonder what to change in order to take advantage of these features. Are there commands to specify a cluster and the cluster data store and let the DRS to decide the initial investment for a new virtual machine? At the moment we put all hosts and the warehouses of data as variables and use them in the line below.

    Thank you.

    $newVM = New-VM-name $NewVMname - VM $TemplateName Datastore - $datastore - VMHost $vHost - confirm: $false - location $myName

    You set a Datastorecluster?

    If Yes, then you can replace the value of parameter data with the datastorecluster object store.

    Replacing a VMHost with a cluster is not taken in charge I'm afraid.

    But you can use something like this

    New-VM-name TestVM Datastore - DSC - ResourcePool (Get-Cluster-name mycluster |) Get - Resourcepool - name of resources)

    This will automatically select the VMHost.

    The virtual machine appears in the root of the cluster.

    DSC is the name of a datastorecluster in the cluster mycluster

  • Script to check the version of Cisco VEM on ESXi host

    Hallo,

    I need help, a script to check and report in a CSV file, the version of Cisco Nexus 1000v VEM on all ESXi hosts connected to a vCenter.

    Basically, "vem version - v" but for all the ESXi hosts connected to a vCenter.

    Thank you

    Joseph

    I suspect you could use PowerShell v1, in this version that the Export-Csv has not had the UseCulture parameter.

    Try to run the script without this parameter.

    But I would strongly suggest to upgrade your version of PowerShell (v3 is available)

  • PowerCLI script to check the setting of syslog on a whole cluster?

    Hey guys,.

    I'm looking for a way to check the setting configured for syslog remote on a large cluster of ESXi. Is it possible to easily check by cluster?

    Thanks in advance,

    The following PowerCLI script will give you the servers remote syslog for all hosts in a cluster:

    Get-Cluster "MyCluster" | Get-VMHost | ForEach-Object {
      $VMhost = $_
      $VMHost | Get-VMHostSysLogServer | ForEach-Object {
        $Report = "" | Select-Object -Property VMHost,SyslogServer,Port
        $Report.VMHost = $VMhost.Name
        $Report.SyslogServer = $_.Host
        $Report.Port = $_.Port
        $Report
      }
    }
    

    Best regards, Robert

  • Script to check the correct resource pools

    Hi guys

    Hoping someone can help with PowerCLI issue?

    I want to set up a script PowerCLI who together share CPU and memory allocated to all VMS in each Resource Pool, add them together and compare them with resource information in the list of resources and those who differ from a CSV output (including how on every property is different).

    The idea is that this script will quickly check through our vast domain for incorrectly configured in the resource pools (ie. those who have not been updated).

    Anyone able to help give advice on how I can get that data into PowerCLI from the pool of resources and the virtual computer?

    Thank you very much

    -


    a crazy penguin

    http://www.acrazypenguin.com

    I don't know if the values you provide are correct for what is planned.

    Especially the MaxCpuUsage won't say much because this will normally reflect the total amount of CPU resources on the host (provided that the customer has no defined limits).

    The following should give a better picture (I guess)

    $dcName = 
    $report = @()
    $dc = Get-View -ViewType Datacenter -Filter @{"Name"=$dcName}
    Get-View -ViewType ResourcePool -SearchRoot $dc.MoRef | where{$_.Name -ne "Resources"} | %{
         $rp = $_
         $rpMem = 0
         $rpCpu = 0
         Get-View -ViewType VirtualMachine -SearchRoot $rp.MoRef | %{
              $rpMem += $_.Summary.QuickStats.hostMemoryUsage
              $rpCpu += $_.Summary.QuickStats.overallCpuUsage
         }
         $report += New-Object PSObject -Property @{
              Name = $rp.Name
              "VmCpuTotal (MHz)" = $rpCpu
              "VmMemTotal (MB)" = $rpMem
              RpCpu = $rp.Runtime.Cpu.UnreservedForVm
              RpMem = $rp.Runtime.Memory.UnreservedForVm / 1MB
         }
    }
    $report | Export-Csv "C:\ResPool.csv" -NoTypeInformation -UseCulture
    

    Note that this does not overcommitment account. To have the script must use the unreservedForPool rather than the UnreservedForVm property property.

  • SQL script to check the status of the last command

    Hi all

    I need to make a SQL script and call it from Unix (bash) shell.


    =========================
    sqlplus vikas/vikas < < END
    coil /oracle/vikas/output.txt
    order 1
    command 2
    ...
    ....
    command N
    spool off;
    commit;
    END
    =========================


    It works perfectly, but my problem is that if a command fails, the other controls in suite works. However, I need to keep a check when a broken command that you exit the script.

    On unix, we have an option of echo $? to check the status of the previous command, but how to accomplish this SQL.

    Pls help!
    __________________
    == > VIKAS < ==

    =========================
    sqlplus vikas/vikas<>
    coil /oracle/vikas/output.txt
    WHENEVER SQLERROR EXIT; -Add this
    order 1
    command 2
    ...
    ....
    command N
    spool off;
    commit;
    END
    =========================

  • Looking for a Script to check the current status of the VM tools based on resource pool (customer name)

    Hi all and

    LucD The champion!

    I'm looking for a power-cli script to verify the State of VM-tools of all the virtual machines in the cluster multi environment. Could you please help me on this. It would be really appreciated.

    Thank you. in advance.

    Concerning

    Nauman

    Try like this

    $report = @)

    {foreach ($cluster Get-cluster)

    foreach ($rp in Get-ResourcePool-location $cluster) {}

    foreach ($vm in (Get-VM-location the $rp)) {}

    $report += get-disk hard - VM $vm |

    Select @{N = "Cluster"; E = {$cluster. Name}},

    @{N = "ResourcePool"; E = {$rp. Name}},

    @{N = "VM"; E = {$vm. Name}},

    @{N = 'Tools status'; E = {$vm. ExtensionData.Guest.ToolsStatus}},

    @{N = 'HD'; E={$_. Name}},

    @{N = "Datastore"; E={($_. Filename.Split(']') [0]). TrimStart('[')}},

    @{N = 'Filename'; E={($_. Filename.Split('_') [1]). "Split('/') [0]}},"

    @{N = 'Path VMDK'; E={$_. File name}}.

    @{N = "Format"; E={$_. StorageFormat}},

    @{N = ' Type'; E={$_. DiskType}},

    @{N = "CapacityGB"; E={$_. CapacityGB}}

    }

    }

    }

    $report | Export Csv C:\temp\report.csv - NoTypeInformation - UseCulture

  • Apple script to check the part of iTunes library XML with another application.

    Y at - there no apple for script

    Set 'share the XML library with other applications iTunes'. under the name selected

    • iTunes
    • Preferences
    • Advanced tab...

    I want to read itunes Media Library .xml, but in the last version of iTunes without xml is created by default,

    so I want this XML created by my application through the apple script.

    iTunes12.4

    I don't think you can change that setting via AppleScript, however once you have enabled then the XML file will be generated and updated every time that the library is updated.

    TT2

  • Script to check the speed and duplex

    Hey all,.

    I've been looking and trying to find a script to export to a CSV one sheet simple display of speed and duplex of physical network adapters in our environment.  Any advice would be greatly appreciated!

    Get-VMHostNetworkAdapter |? {$_. Name: match "vmnic" - and $_. {BitRatePerSec - only '0'} | Select vmhost, name, BitRatePerSec, FullDuplex | Export-CSV-Path "C:\PowerCLI Scripts\Reports\VMNICs.csv" - NoTypeInformation - UseCulture

    The above should work. Have no PowerCLI on my phone to test if

  • Form to fill out, script to check the e-mail address

    I'm trying to write a script so that in one of my fields to fill in, I want to make sure the email address is correctly inscription.

    example * @*. *

    I don't like on the first name or the field simply that the end user it entered correctly.

    example [email protected] and not abc@domaincom or abc@domainnet etc...

    Adobe Pro X

    You can use it as the custom field validation:

    If (event.value) event.rc = eMailValidate (event.value);

  • How to check the growth of the database for a database on ASM?

    Hello

    I have been using the following script to check the growth of the database (for DBs on file system):
    SELECT b.tsname tablespace_name ,
      MAX(b.used_size_mb) cur_used_size_mb ,
      ROUND(AVG(inc_used_size_mb),2)avg_increas_mb
    FROM
      (SELECT a.days,
        a.tsname ,
        used_size_mb ,
        used_size_mb - LAG (used_size_mb,1) OVER ( PARTITION BY a.tsname ORDER BY a.tsname,a.days) inc_used_size_mb
      FROM
        (SELECT TO_CHAR(sp.begin_interval_time,'MM-DD-YYYY') days ,
          ts.tsname ,
          MAX(ROUND((tsu.tablespace_usedsize* dt.block_size )/(1024*1024),2)) used_size_mb
        FROM dba_hist_tbspc_space_usage tsu ,
          dba_hist_tablespace_stat ts ,
          dba_hist_snapshot sp,
          dba_tablespaces dt
        WHERE tsu.tablespace_id    = ts.ts#
        AND tsu.snap_id            = sp.snap_id
        AND ts.tsname              = dt.tablespace_name
        AND sp.begin_interval_time > sysdate-7
        GROUP BY TO_CHAR(sp.begin_interval_time,'MM-DD-YYYY'),
          ts.tsname
        ORDER BY ts.tsname,
          days
        ) a
      ) b
    GROUP BY b.tsname
    ORDER BY b.tsname;
    And I think that he always gave me good results until I ran this script on a database (10.2.0.5) on ASM.

    Is it because the databases on the ASM are maintaied differently, OR do most proabbly there was no activity on this database in the last 7 days? I even ran this query for last 90/180 / day and it is me again after results:
    TABLESPACE_NAME                CUR_USED_SIZE_MB AVG_INCREAS_MB
    ------------------------------ ---------------- --------------
    SYSAUX                                   574.38            .36
    SYSTEM                                   514.69              0
    DATA                                    1593.25              0
    IDX                                         .06              0
    UNDOTBS1                                  69.06          -3.84
    USERS                                     96.13              0
    Thanks in advance!

    I have no reason to believe tablespaces under ASM are maintained differently, so the most likely explanation is the change in the activity of the DB.

    What is your AWR retention? The default value is 7 days, so if yours is set to the default value, and then by running the query for 90/180 days you would not give more information.

    If you want to get the output of your scripts, you may need to adjust the AWR retention and your tablespace SYSAUX respectively.

    If the DB is managed by Oracle Enterprise Manager (OEM), you can make tablespace forecast based on the measurements taken by the OEM. I did a presentation on this (NYOUG, VirtaThon) just now:
    http://iiotzov.files.WordPress.com/2011/08/iotzov_oem_repository.PDF
    http://iiotzov.files.WordPress.com/2012/05/OEM-repository-a-second-look.doc

    Lordane Iotzov

  • How to check the ESXi for all VMhost root password in the VCenter?

    Hello

    Can anyone please he share way or any script to check the credentials of the VMware root?

    rather than trying to connect each VMhost ESX(I) with vsphere client is too much of a work

    The reason for which the supplied LucD script does not work is because you have to change $_ to $esx (see below). You use the $_ when your piping output of one command to another. Given that we use, we use a loop Foreach access us the individual elements of the command Get-VMHost through the defined variable (the $esx in the 3rd line)

    SE connect-VIServer-Server $esx - user $user-password $pswd - ErrorAction Stop | Out-Null

  • Check the resolution and write in CSV

    I need a script that checks the resolution of an image and if the resolution is less than 300, it must create a CSV/text file in desktop with the string "the resolution is less than 300. Is it possible to do using script? Please advise.

    Audit of the resolution should not be difficult.

    var theRes = app.activeDocument.resolution;
    if (theRes < 300) {/*insert code here*/};
    

    This could be used to write a txt file, but there are probably other examples on this Forum and http://ps-scripts.com/bb/

    ////// function to write a preference-file storing a text //////
    function writePref (theText, thePath) {
      try {
        var thePrefFile = new File(thePath);
        thePrefFile.open("w");
        for (var m = 0; m < theText.length; m ++) {
          thePrefFile.write(theText[m])
          };
        thePrefFile.close()
        }
      catch (e) {};
      };
    

Maybe you are looking for