Need help to be able to enter a cluster name, and to determine the other 2 variables

All,

If possible, I would like to be able to enter a cluster name powercli and use this piece of information to determine the 2 variables.

Variable 1 - I would like to take the cluster name and the name of esx host with the least amount of VM output.

Variable 2 - then I want to take this ESX host and the data store that has the most space of output.  A condition for this is that it must have more free space, but also have a minimum of 130 GB of available.

Any ideas?

It seems that I've lost a line during the copy, sorry about that.

$freeGBTgt = 130
$clusterName = Read-Host -Prompt "Enter a clustername"

$min = 9999
Get-Cluster -Name $clusterName | Get-VMHost | %{
     if($_.Extensiondata.Vm.Count -lt $min){
          $minVmHost = $_.Name
          $min = $_.Extensiondata.Vm.Count
     }
}
Write-Host "In cluster" $clusterName "server" $minVmHost "has the least guests"

$maxDsFree = 0
Get-VMHost -Name $minVmHost | Get-Datastore | %{
     if($_.FreeSpaceMB -gt ($freeGBTgt * 1KB) -and $_.FreeSpaceMB -gt $maxDsFree){
          $dsName = $_.Name
          $maxDsFree = $_.FreeSpaceMb
     }
}
if($maxDsFree -ne 0){
     Write-Host "On host" $minVmHost "datastore" $dsName "has" ($maxDsFree/1KB) "GB free space"
}
else{
     Write-Host "On host" $minVmHost "there is no datastore with more than" $freeGBTgt "GB free space"
}

____________

Blog: LucD notes

Twitter: lucd22

Tags: VMware

Similar Questions

  • Pls I need help to reset my bios of my computer compaq mini CQ10. The error code is CNU9513HB4

    Pls I need help to reset my bios of my computer compaq mini CQ10. The error code is[personal information deleted]

    Hello

    Please try (all lower case):

    e9loq3fzpv (3rd tank is a tiny l).

    Kind regards.

  • I need help deleting these accounts quickly because I'm not going to use the most.

    Cancel/delete email

    Hello look at these emails I created just a mess.

    I need help deleting these accounts quickly because I'm not going to use the most.

    I want just all my information wiped out of these emails

    & When they are removed and all of my information are wiped out, I want these emails to become available and new to others for their use.

    E-mail address is removed from the privacy *.

    E-mail address is removed from the privacy *.

    E-mail address is removed from the privacy *.

    E-mail address is removed from the privacy *.

    E-mail address is removed from the privacy *.

    E-mail address is removed from the privacy *.

    E-mail address is removed from the privacy *.

    E-mail address is removed from the privacy *.

    E-mail address is removed from the privacy *.

    E-mail address is removed from the privacy *.

    E-mail address is removed from the privacy *.

    E-mail address is removed from the privacy *.

    E-mail address is removed from the privacy *.

    E-mail address is removed from the privacy *.

    E-mail address is removed from the privacy *.

    Please thank you.

    It is just a JOKESTER, but you're talking about Hotmail accounts? If so, please ask here.

    Windows Live Solution Center Hotmail Forum
    http://windowslivehelp.com/forums.aspx?ProductID=1

  • Hi, I need help, because I have a cancelled plan but I do not have the return!

    Hi, I need help, because I have a cancelled plan but I do not have the return!

    Hello

    I will arrange for the refund to be processed - please allow 3-5 days.

    Kind regards

    Bev

  • I need help on how to audio output when I go. I ticked the box at the bottom, but when I go to view my video on quicktime, it does not play audio.

    I need help on how to audio output when I go. I ticked the box at the bottom, but when I go to view my video on quicktime, it does not play audio.

    GUYS, I GOT IT. AND THE SOLUTION IS WAYYYYY WITH JUST A RENDERING. So after countless time I spent trying to make it, I found a way that me really happy that my old rendering has not worked. All you have to do is download adobe media encoder and BAM your gold. I make it in h.264 that i couldt using the old rendering and now it works fine.

  • Hello, need help for Adobe Reader DC playing animation files that are specified in the pdf output by script Latex Beamer. My Adobe Reader DC refuse to open any format that I gave him.  Thank you very much

    Hello, need help for Adobe Reader DC playing animation files that are specified in the pdf output by script Latex Beamer. My Adobe Reader DC refuse to open any format that I gave him.  Thank you very much

    Hey ihorl18351266,

    Please note that you can open PDF files using only the CD player. Any other format will not be supported by the software.

    Kind regards

    Ana Maria

  • How can I cancel my account when the need help page only allows me to go to forums and does no real contact for adobe?

    How can I cancel my account when the need help page only allows me to go to forums and does no real contact for adobe? How can I contact Adobe actually?

    Please contact support by calling/chat for cancellation requests and billing queries:

    Contact the customer service

    * Be sure to stay connected with your Adobe ID before accessing the link above *.

    You can also check the help below document:

    https://helpx.Adobe.com/x-productkb/policy-pricing/cancel-membership-subscription.html

    Please go through the Adobe - General conditions of subscription as well.

    Concerning

    Stéphane

  • Need help to create a workspace to keep my guides and leaders to a predefined dimension.

    Need help to create a workspace to keep my guides and leaders to a predefined dimension?

    Might be interesting to set up an action to do this.

    The next time that you create your folder of the workspace, an action, then you have this will define and at a click of a button you will have the same workspace each time.

  • autologin Windows 7 without box "users must enter a user name and password to use this computer"

    My dialog box user accounts does not the box "users must enter a user name and password to use this computer" and how do I turn it on?

    Hello Russ,

    You can continue with the following steps to support.  However, if your computer is on a domain, unfortunately, there's nothing we can do.  You will need to contact the system/network administrator.  TechNet forums can be beneficial for a resolution on your http://social.technet.microsoft.com/Forums/en-us/category/w7itproinquiry.  Please create a Restore Point and backup of the registry before proceeding.

    1. click on start, run, type regedit, and then click OK.
    2. look for the following registry key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon
    3. with the help of your account name and password, double-click the DefaultUserName entry, type your user name, and then click OK.
    4. double-click the DefaultPassword entry, type your password in the value data box, and then click OK.

    If there is no DefaultPassword value, create the value. To do this, follow these steps: a. in the registry editor, click on edit, click New, and then click String value.
    b. Type DefaultPassword as the value name, and press ENTER.
    c. double-click the newly created key, and then type your password in the value data box.
    If no DefaultPassword string is specified, Windows XP automatically changes the value of the AutoAdminLogon registry key by replacing 1 (true) to 0 (false) to turn off the AutoAdminLogon feature.
    5 double-click the AutoAdminLogon entry, type 1 in the value data box, and then click OK.

    If there is no AutoAdminLogon entry, create the entry. To do this, follow these steps: a. in the registry editor, click on edit, click New, and then click String value.
    b. type AutoAdminLogon as the value name, and press ENTER.
    c. double-click the newly created key, and then type 1 in the value data box.
     
    6. exit the registry editor.
    7. click on start, click on restart and then click OK.

    I hope that this information is beneficial

    Thank you

    Aaron
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • My wife has an i5 to 2.3 GHz MacBook Pro early 2011 and it worked like a slug.  Ran disk utility and verified that the disk needs repair using recovery HD.  What does this lead and what is the risk of losing all the data is there?

    My wife has an i5 to 2.3 GHz MacBook Pro early 2011 and it worked like a slug.  Ran disk utility and verified that the disk needs repair using recovery HD.  What does this lead and what is the risk of losing all the data is there?

    Even if it is very slow, you must make a return upwards before the race "repair disk". The risk of data loss is minimal, but do it anyway: Save and run to repair the disk.

    As for what it implies - most of the time nothing more than simply sitting and waiting to do his thing.

  • What I need to know is the name and location of the executable that runs when you click on detect monitors in the menu screen resolution of windows 7?

    Original title: name/location of the executable that runs when you click on detect monitors?

    What I need to know is the name and location of the executable that runs when you click on detect monitors in the menu screen resolution of windows 7?

    Hello

    Your question is better suited in the MSDN forums. Please post your question in the MSDN forums.

    You can follow the link to your question:
    http://social.msdn.Microsoft.com/forums/en-us/categories/

    It will be useful.

  • I'm trying to install Adobe PS CS3 for my boss on another computer. I put the program on a hard disk and copied to the other computer now, it does not open and said he needs the license. What can I do to make it work on this computer?

    I'm trying to install Adobe PS CS3 for my boss on another computer. I put the program on a hard disk and copied to the other computer now, it does not open and said he needs the license. What can I do to make it work on this computer?

    Copy the program through a new machine will not work.   Install it using installation files and activate using the serial number assigned to the license.

    CS3 - http://helpx.adobe.com/creative-suite/kb/cs3-product-downloads.html

  • What should I enter for "User Name" when you install the first 12 items on a Windows 7 computer?

    What should I enter for "User Name" when you install the first 12 items on a Windows 7 computer?

    Thank you

    TS

    Kglad

    I used the default value presented to me (computer username) and installed fine.

    Thanks for your comments.

    Concerning

    TS

  • I need help. My House was broken into my computer and all (!) I mean that everything was stolen from me and my husband.

    CAN SOMEONE HELPME FIND MY STOLEN COMPUTER? I HAVE ALL THE DOCUMENTS FROM WHEN I BOUGHT IT. Serial number... and it's bright pink for *... hard to Miss cancer awareness. PLEASE SOMEONE HELP ME.  The police suggested I take this action first thinking I might be able to know where the INVESTIGATION period and that comes from the period of INQUIRY.

    Thank you God bless you.

    Hi victorialakeplayer2,

    Sorry to hear that your laptop is stolen. Did you buy Lojack or any of the other software anti theft? If you do not you will need to get a police report and fill out this form and send it to Dell. Dell cannot track the IP address and can only the service tag of the Pavilion in the system if anyone tries to change the property at Dell.

    https://support.Dell.com/support/topics/global.aspx/support/dellcare/stolen_system?~CK_=_ln & c = us & l = en & lnki = 0 & s = gen & DoNotRedirect = y

  • Need help with Oracle SQL merge records according to date and term dates

    Hi all

    I need help to find this little challenge.

    I have groups and flags and effective dashboards and dates of term against these indicators according to the following example:

    GroupName Flag_A Flag_B Eff_date Term_date
    Group_ATHERETHERE2011010199991231
    Group_ANN2010010120101231
    Group_ANN2009010120091231
    Group_ANN2006010120081231
    Group_ANTHERE2004010120051231
    Group_ATHERETHERE2003010120031231
    Group_BNTHERE2004010199991231
    Group_BNTHERE2003010120031231

    As you can see, group_A had the same combination of (N, N) flag for three successive periods. I want to merge all the time periods with the same indicators in one. Where entry into force will be the most early (underlined) time period and end date will be later (underlined)

    So the final result should look like this:

    GroupName Flag_A Flag_B Eff_date Term_date
    Group_ATHERETHERE2011010199991231
    Group_ANN2006010120101231
    Group_ANTHERE2004010120051231
    Group_ATHERETHERE2003010120031231
    Group_BNTHERE2003010199991231

    Thanks for your help

    Here's the DDL script

    drop table TMP_group_test;

    create table TMP_group_test (groupname varchar2 (8))

    , flag_a varchar2 (1)

    , flag_b varchar2 (1)

    , eff_date varchar2 (8)

    , term_date varchar2 (8)

    );

    insert into TMP_group_test values ('Group_A', 'Y', 'Y', ' 20110101 ', ' 99991231');

    insert into TMP_group_test values ('Group_A', 'n', ' n ', ' 20100101 ', ' 20101231');

    insert into TMP_group_test values ('Group_A', 'n', ' n ', ' 20090101 ', ' 20091231');

    insert into TMP_group_test values ('Group_A', 'n', ' n ', ' 20060101 ', ' 20081231');

    insert into TMP_group_test values ('Group_A', 'n', 'Y', ' 20040101 ', ' 20051231');

    insert into TMP_group_test values ('Group_A', 'Y', 'Y', ' 20030101 ', ' 20031231');

    insert into TMP_group_test values ('Group_B', 'n', 'Y', ' 20040101 ', ' 99991231');

    insert into TMP_group_test values ('Group_B', 'n', 'Y', ' 20030101 ', ' 20031231');

    commit;

    Post edited by: user13040446

    It is the closest, I went to the solution


    I create two rows;

    Rnk1: partition by group name, order of eff_date / / desc: this grade will sort the records of the most recent and handed to zero for each group\

    Rnk2: (dense) partition by group name, flag_A, flagb: this grade for each combination of group\flag gives a number so that they are classified as "families".

    Then I use the function analytic min

    Min (eff_date) more (partition of GroupName, rnk2): the idea is that, for each Member of the same family, the new date is the min of the family (and the max for the date of the term), at the end I just need separate so that the duplicates are gone

    Now the problem. As you can see from the query below, records of 1 and 6 (as identified by rownum) are identified in the same family, because they have the same combination of flag, but they are not successive, so everyone must keep its own date of entry into force.

    If only I can make the distinction between these two that would solve my problem


    Query:


    Select rowNum,GroupName, flag_a, flag_b, eff_date, term_date, rnk1, rnk2

    , min (eff_date) more than (partition by GroupName rnk2( ) min_eff

    Of

    (

    Select rowNum,

    GroupName , flag_a , flag_b , eff_date , term_date

    rank() more than (partition by GroupName stopped by eff_date desc) rnk1

    DENSE_RANK() more than (partition by GroupName order by flag_A flag_B ( ) rnk2

    de dsreports . tmp_group_test

    ) order by rowNum

    Hello

    user13040446 wrote:

    Hi KSI.

    Thanks for your comments, you were able to distinguish between these lines highlight, but lost lines 2,3,4 which are supposed to have the same date min = 20060101.

    Please see the table wanted to see the final result I want to reach

    Thanks again

    This first answer is basically correct, but in the main query, you want to use the function MIN, not the analytical function aggregation and GROUP BY columns with common values, like this:

    WITH got_output_group AS

    (

    SELECT GroupName, flag_a, flag_b, eff_date, term_date

    ROW_NUMBER () OVER (PARTITION BY GroupName

    ORDER BY eff_date

    )

    -ROW_NUMBER () OVER (PARTITION BY GroupName, flag_a, flag_b)

    ORDER BY eff_date

    ) AS output_group

    OF tmp_group_test

    )

    SELECT GroupName, flag_a, flag_b

    MIN (eff_date) AS eff_date

    MAX (term_date) AS term_date

    OF got_output_group

    GROUP BY GroupName, flag_a, flag_b

    output_group

    ORDER BY GroupName

    eff_date DESC

    ;

    The result I get is

    GROUP_NA F F EFF_DATE TERM_DAT

    -------- - - -------- --------

    Group_A Y 20110101 99991231 Y

    N Group_A 20101231 20060101 N

    Group_A N 20051231 20040101 Y

    Group_A Y Y 20031231-20030101

    Group_B N Y 99991231 20030101

    which is what you asked for.

Maybe you are looking for

  • A PXI Module will work in a chassis/slots SMU

    Simple question and the title says it all really. I'm 99% sure that it used because I do not know the connector backplane is different but thought I would ask for clarification. Congratulations in advance. Mitch

  • Windows 7 media center tv guide planning lost .dll

    My anti-virus found a .dll suspect something like a regular planning. I deleted the .dll file and it seems that it was necessary for the update to Windows 7 media center tv guide (now displays the available data). I have reset media center several ti

  • Dv6T 1-7 720quad driver Turbo Boost

    Hi I recently had to format my hard drive and reeistall homex64 of windows 7 on my laptop dv6t select Edition. I have the intel 720qm quad core i-7. I found the drivers on the hp site for my model and downloaded and installed the chipset driver and r

  • Creating Windows DVD - decoding problem?

    Hello. Recently, I tried to use Windows DVD Maker for the first time. Files added in the right menu and I could create a menu and listen to excerpts from the DVD. When I click on the button to burn, however, the DVD does that make to 1.7% full and wa

  • OS7 JavaScript BlackBerry right shift (> >) operator number

    Hello We use JavaScript to create the encryption module. It worked without problem until recently it did not work on Blackberry OS 7 (tested on the Blackberry Bold 9900 Touch). He was not throwing error but generated a result of encryption that could