Report selected datastore PowerCLI

Hello

Please can we suggest a script or modify below a, to only generate a report for specific data storage. I don't want a report for each unique data store in vCenter, those special.

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

$fileloc = "c:\output.htm".
$body = "This is Datastore using PowerCLI export.
$mailfrom = "e-mail address".
$to = 'mailaddress1, mailaddress2 '.
$subject = 'this message is sent by PowerCLI script.
$smtpserver = "IP address of your SMTP server"

$datastores = get-vmhost | Get-Datastore. Sort-Object Name
$myColCurrent = @)

{foreach ($store in $datastores)
$myObj = "" | CapacityGB, UsedGB, PercFree, Select-Object Name, Type, ID, Accessible
$myObj.Name = $store. Name
$myObj.CapacityGB = '{0:n2}' f ($store.capacityMB / 1 kb)
$myObj.UsedGB = '{0:N2}' f (($store.)) CapacityMB - $store. (FreeSpaceMB) / 1 KB)
$myObj.PercFree = ' 0: {n} ' f (100 * $store.) Store FreeSpaceMB / $. CapacityMB)
$myObj.Type = $store. Type
$temp is get-view-Id $store. ID
$myObj.ID = get-DSDevice $store
$myObj.Accessible = $store. Accessible
$myColCurrent += $myObj
}

# Export the output
$myColCurrent | ConvertTo-Html-of title "Datastore" - body "< H2 > Information Datastore.". "< / H2 > ' | Out-file - add $fileloc

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

Thank you

Pls change the first line

$fileloc = "c:\output.htm".

Tags: VMware

Similar Questions

  • Dynamic action function Interactive report select value list

    I want to perform an Action when a user selects one of the 3 options in a selection list in an interactive report:

    Select APEX_ITEM. SELECT_LIST)
    p_idx = > 3,
    -p_value = > deptno,.
    p_list_values = > ' copy; Copy, delete, delete, export to PDF format. Export to PDF ',
    -p_attributes = > "style =" color: red; ' " ',
    p_show_null = > 'YES ', he said.
    p_null_value = > NULL,
    p_null_text = > "- Select -",
    -p_item_id = > ' f03_ #ROWNUM #'.
    p_item_id = > 'P6_IR_SELECT_LIST ',.
    p_item_label = > ' label for ROWNUM f03_, #
    p_show_extra = > 'YES') "Actions".
    Double;

    When you generate the dynamic Action, I chose the following values of the Advanced Wizard
    Event: select
    Selection type: DOM object
    DOM object: P6_IR_SELECT_LIST
    Condition: Equal to
    Value: 'delete '.

    Action: Run the Code JavaScript: Alert ('Here');

    Does not seem to be shooting... can anyone help?

    Thanks in advance,
    John

    The problem is the type of event.

    'Select' fires when text is selected in a text field, not when an option is selected in a list...

    Try instead "change."

  • Problem with the cascading for interactive report selection list

    Hi all.

    I'm trying to implement the solution of cascading to the tabular presentation list.

    https://Apex.Oracle.com/pls/Apex/f?p=31517:176:103661090335568:

    But instead of the form of paintings, I use interactive report. After executing the query, I get the error:

    ORA-06550: line 1, column 147: PL/SQL: ORA-00936: lack of expression ORA-06550: line 1, column 13: PL/SQL: statement ignored


    My Sql query for the report:

    select 
    apex_item.hidden(1, a."DATA_ID")DATA_ID,
    apex_item.select_list_from_query(10,
      b.WAVE_GROUP,
     'select GROUP_DISPLAY, GROUP_RETURN from dwd_wave_group',
     'onchange="f_set_casc_sel_list_item(this,f11_'||LPAD (a.DATA_ID, 4,'0')||')"',
     'YES',
     '',
     '- Select Group -',
     'f10_' || LPAD (a.DATA_ID, 4, '0'),
      NULL,
     'NO'
     )WAVE_GROUP,
    apex_item.select_list_from_query(11, b."WAVE_USER",
    'SELECT username d, '
    ||'username r FROM dwd_user where groups = '||b."WAVE_GROUP",
    '',
    'YES',
    '', 
    '- Select User -',
    'f11_' || LPAD (a.DATA_ID, 4, '0'),
     NULL,
    'NO'
    )WAVE_USER
    from "DWD_WAVE_MASTER" a, dwd_wave_assignment b
    where a.data_id = b.data_id
    and b.wave_id = 'wave_1'
    

    If I exclude the condition 2nd selection list query and change as below then everything works fine. Query does not give error on sql developer.

    Use: APEX 4.2.6 with Database 11g.

    apex_item.select_list_from_query(11, b."WAVE_USER",
    'SELECT username d, '
    ||'username r FROM dwd_user',
    '',
    'YES',
    '', 
    '- Select User -',
    'f11_' || LPAD (a.DATA_ID, 4, '0'),
     NULL,
    'NO'
    )
    

    Can someone please help!

    Thank you

    Nabila

    The nabila Islam wrote:

    I'm trying to implement the solution of cascading to the tabular presentation list.

    https://Apex.Oracle.com/pls/Apex/f?p=31517:176:103661090335568:

    But instead of the form of paintings, I use interactive report. After executing the query, I get the error:

    ORA-06550: line 1, column 147: PL/SQL: ORA-00936: lack of expression ORA-06550: line 1, column 13: PL/SQL: statement ignored

    My Sql query for the report:

    1. Select
    2. apex_item. Hidden (' 1, a. "DATA_ID DATA_ID").
    3. apex_item.select_list_from_query (10,
    4. b.WAVE_GROUP,
    5. "select GROUP_DISPLAY, GROUP_RETURN from dwd_wave_group,"
    6. "onchange =" f_set_casc_sel_list_item (this, f11_'|) LPAD (a.DATA_ID, 4, '0'). ") » ',
    7. '' YES. ''
    8. '',
    9. -Select Group «-»,
    10. "f10_" | LPAD (a.DATA_ID, 4, '0'),
    11. NULL,
    12. 'NO '.
    13. ) WAVE_GROUP,.
    14. apex_item.select_list_from_query ("11, b.") WAVE_USER,"
    15. "SELECT user name d.
    16. |' username r FROM dwd_user where group = ' | b."WAVE_GROUP."
    17. '',
    18. '' YES. ''
    19. '',
    20. "- Select user -",
    21. "f11_" | LPAD (a.DATA_ID, 4, '0'),
    22. NULL,
    23. 'NO '.
    24. ) WAVE_USER
    25. of 'DWD_WAVE_MASTER' a, b dwd_wave_assignment
    26. where a.data_id = b.data_id
    27. and b.wave_id = 'wave_1. '

    If I exclude the condition 2nd selection list query and change as below then everything works fine. Query does not give error on sql developer.

    Use: APEX 4.2.6 with Database 11g.

    1. apex_item.select_list_from_query ("11, b.") WAVE_USER,"
    2. "SELECT user name d.
    3. |' username r FROM dwd_user ",
    4. '',
    5. '' YES. ''
    6. '',
    7. "- Select user -",
    8. "f11_" | LPAD (a.DATA_ID, 4, '0'),
    9. NULL,
    10. 'NO '.
    11. )

    What is the data type of DWD_WAVE_ASSIGNMENT. WAVE_GROUP? If it is not a number, then it must be enclosed in quotes when it is used as a literal:

    apex_item.select_list_from_query(11, b."WAVE_USER",
    'SELECT username d, '
    
    ||'username r FROM dwd_user where groups = ' || dbms_assert.enquote_literal(b."WAVE_GROUP"),  
    
    '',
    'YES',
    '',
    '- Select User -',
    'f11_' || LPAD (a.DATA_ID, 4, '0'),
    NULL,
    'NO'
    )
    
  • textarea in the report, select

    Hi all.

    I built the simple report based on select.

    That looks like this:

    Select

    of any_table d

    When trunc (d.date) between: P1_BEG and: P1_END

    and some_any_field in (: P1_ITEMS)

    where ': ' P1_ITEMS is textarea with the list of available items.

    Could someone help me.

    Thanks in advance.

    Andrii.

    I find a problem.

    First I created the point of the application.

    Then I created a process now present before computetion and validation, where I copy the textarea to the application element element.

    Start

    APEX_UTIL. SET_SESSION_STATE('APPLICATION_ITEM',:P1_ITEM);

    apex_debug.message ('debug apex!': v ('APPLICATION_ITEM'));

    end;

    In, select report, I wrote instr ((v ('APPLICATION_ITEM')), some_any_field) > 0

  • Check box in the header of the classic report: select all the report Archives

    Hi friends,

    I use Apex 4.2 worm.

    I've created a classic report and create the check box (apex_item.checkbox (1), EMPNO, 'DISABLED' tick,) in this report.

    My Code

    Select * from)

    Select

    apex_item. CheckBox (1), EMPNO, "DISABLED" tick.

    "EMPNO', 'ENAME', 'JOB', 'MGR', 'HIREDATE',"SAL","COMM","DEPTNO. "

    from EMP)

    where)

    InStr (upper ("ENAME"), upper (nvl (: P6_REPORT_SEARCH, "ENAME"))) > 0 or

    InStr (upper ("JOB"), upper (nvl (: P6_REPORT_SEARCH, "JOB"))) > 0

    ) and

    (nvl(:P6_ENAME,'0') = '0' or ENAME =: P6_ENAME) and

    (nvl(:P6_JOB,'0') = '0' or JOB =: P6_JOB) and

    (nvl(:P6_MANAGER,'0') = '0' or MGR =: P6_MANAGER)

    and

    (nvl(:P6_DEPT_NO,'0') = '0' or DEPTNO =: P6_DEPT_NO)

    I need to create the checkbox in the header of the classic as tabular report where if I click in the header box then all archives should be checked.

    How can I do this with classic report.

    If you want to see this issue in the workspace, then you can use the workspace details below

    Workspace: APEX_ISSUE

    User name: [email protected]

    Password: kaushik1@34

    Page no.: 6

    Thank you

    Hi Maxence,

    The above problem is solved. Please check the same.

    I added the following code in the header of the first column:

    
    

    NOTE: I used Carl Backstrom solution for this: Blog of Carl Backstrom: Mini check all HowTo

    But this solution works only when the first column in your report / table is a checkbox.

    If you have more columns rather than the first column where you want to check and uncheck all the features then follow the solution of Jeff Kemp:

    http://jeffkemponoracle.com/2012/11/15/select-all-Unselect-all-checkbox-in-interactive-report-header/

    I hope this helps!

    Kind regards

    Kiran

  • How to create a parameterized report - select "- ALL -" for the Department and manager does not.

    I downloaded the app OEHR sample of objects and followed the steps in Oracle® Application Express Advanced Tutorials
    Version 3.2.

    The report and the settings seem to work fine except when I get 'everything' for service or manager I get no corresponding success.

    What is the way most effective to get 'everything' if the user selects all for dept and mgr - so we would like to return all records in the table.

    Snipprt region

    Enter search Edit   
    Edit
    Edit
    Edit

    Here is the sql code that was provided as part of the turitoral.

    SELECT

    'OEHR_EMPLOYEES '. "" EMPLOYE_ID ""EMPLOYE_ID"

    'OEHR_EMPLOYEES '. "" NAME ""FIRST NAME",

    'OEHR_EMPLOYEES '. "" LAST_NAME ""NAME,"

    'OEHR_EMPLOYEES '. "" ""E-MAIL. "

    'OEHR_EMPLOYEES '. "' PHONE_NUMBER '"PHONE_NUMBER. "

    'OEHR_EMPLOYEES '. "' HIRE_DATE ' 'HIRE_DATE ',.

    'OEHR_EMPLOYEES '. "" JOB_ID ' "JOB_ID,

    'OEHR_EMPLOYEES '. "" TREATMENT ""TREATMENT. "

    'OEHR_EMPLOYEES '. "" COMMISSION_PCT ""COMMISSION_PCT. "

    'OEHR_EMPLOYEES '. "" MANAGER_ID ""MANAGER_ID. "

    'OEHR_EMPLOYEES '. "" DEPARTMENT_ID ""DEPARTMENT_ID ".

    Of

    "#OWNER # '." OEHR_EMPLOYEES' 'OEHR_EMPLOYEES '.

    WHERE

    (lower (first_name) like '%' | lower(:P1_NAME) |) '%' OR

    Lower (last_name) like '% "| Lower(:P1_NAME) | '%')

    AND department_id = decode(:P1_DEPT,'%null%',department_id,:P1_DEPT)

    AND manager_id = decode(:P1_MGR,'%null%',manager_id,:P1_MGR)

    Hello

    Use this...

    SELECT

    'OEHR_EMPLOYEES '. "" EMPLOYE_ID ""EMPLOYE_ID"

    'OEHR_EMPLOYEES '. "" NAME ""FIRST NAME",

    'OEHR_EMPLOYEES '. "" LAST_NAME ""NAME,"

    'OEHR_EMPLOYEES '. "" ""E-MAIL. "

    'OEHR_EMPLOYEES '. "' PHONE_NUMBER '"PHONE_NUMBER. "

    'OEHR_EMPLOYEES '. "' HIRE_DATE ' 'HIRE_DATE ',.

    'OEHR_EMPLOYEES '. "" JOB_ID ' "JOB_ID,

    'OEHR_EMPLOYEES '. "" TREATMENT ""TREATMENT. "

    'OEHR_EMPLOYEES '. "" COMMISSION_PCT ""COMMISSION_PCT. "

    'OEHR_EMPLOYEES '. "" MANAGER_ID ""MANAGER_ID. "

    'OEHR_EMPLOYEES '. "" DEPARTMENT_ID ""DEPARTMENT_ID ".

    Of

    "#OWNER # '." OEHR_EMPLOYEES' 'OEHR_EMPLOYEES '.

    WHERE

    (: P1_NAME IS NULL OR)

    (: P1_NAME IS NOT NULL AND)

    (

    (lower (first_name) like '%' | lower(:P1_NAME) |) '%') OR

    (lower (last_name) like '%' | lower(:P1_NAME) |) '%')

    )

    )

    ) AND

    (: P1_DEPT IS NULL or department_id =: P1_DEPT) AND

    (: P1_MGR IS NULL or manager_id =: P1_MGR)

  • How to refresh the report region change which column of report selection list

    Hello
    I worked with apex 4.2 and I create a classic report with list (named loved) select a column in the list change in report, update the table with the new value via JavaScript (change) call and woke up very well, and I change the color of the line was updated to make it different from the other lines now I want to update to the report after doing update without submitting the page to show the new color of line update.
    I called javascript:apex.submit() in the update function, but

    My Question
    1. How do I refresh the report after change report column list without sending page
    2-can we enter column name selection list report to submit the Page to refresh the report area


    Thank you
    Ahmed

    See my answer above!

    Here's what I did:

    • Created two hidden page items

    • Created a dynamic action on the page with three real actions. (1) set the item values page. (2) to execute code to update the plsql table. (3) update the region report

    Thank you
    Vikram

  • Interactive report select all lines

    I have an I / R report that a user can select the columns, and then update > 1 rank a moment with the other page element values.
    I SELECT ALL and CLEAR ALL buttons page.
    The report runs slowly, due to a very complicated sql statement.

    I'm trying to select or clear the column 1 without the 'submission' of the page and re-run the 'slow' report again.
    At present, the SELECT ALL:
    (1 submits the page 2) sets Pxx_SELECT_ALL_ROWS = 'Y' 3) reruns the report with a decoding 'control' of all lines.

    Is there a way to do this WITHOUT submitting the page?

    The box is column 1 of each row by using:
    HTMLDB_ITEM. CHECKBOX
    (1, R.RESEARCH_ID,
    decode (: Pxx_SELECT_ALL_ROWS, 'Y', 'CHECKED',)
    decode (instr (nvl (:Pxx_SELECTED_IDS,0),R.RESEARCH_ID),0,NULL,'CHECKED'))
    )
    AS select_flag,

    Use * $f_CheckAll * JavaScript API

    Just run this JavaScript to check all your column f01

      $f_CheckAll('', true, $('input[name="f01"]'));
    

    OR create a JavaScript function

    function checkall() {
       $f_CheckAll('', true, $('input[name="f01"]'))
    }
    

    Call this function in your button with URLS of the target type and URL value javascript:checkall();

  • BUG? Interactive report select other results of the tab of Page not found

    Hi all

    I have recently updated our installation of the Apex to version 4.0.1 on Oracle 11.2. There, I found the following problem, for which I don't know if it of a bug or not:
    Steps to reproduce:
    1. Select a sample application and open a page that contains a report interavtive
    2 run the page
    3. click on "Actions" and select "filter".
    4. wait for the filter to display, and then select another tab.

    The result is a page not found. The address bar displays the link: http://apex.oracle.com/pls/apex/wwv_flow.accept with no parameters.

    I tried to use a different model and finally I turned to the sample applications. It ends up that question.

    My questions:
    1. is it already known issue
    2. is there a work around? because this can be very annoying for our client.

    Thank you!

    Select this option.

    Published by: user13295208 on 25-Oct-2010 02:54

    Hi Mark,

    I was able to reproduce the problem based on your steps. Thank you! I I produced bug # 10238450 that has already been set for 4.0.2

    Concerning
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • PowerCLI - using script VM + Datastore + Annotations?

    Can someone help me get this script to extract the field of annotations of the virtual machine please?

    Get-data center | Get-Datastore. {ForEach-Object
    $ds = $_. Name
    $_ | Get - VM | {Select-Object Name,@{n='DataStore'; e = {$ds}}
    } | Export Csv C:\VMList.csv - NoTypeInformation - UseCulture

    A virtual machine can have several annotations. I don't know if you want to combine in the same output as data warehouses. The following script lists all the names and values of the annotations of the virtual machine:

    Get-VM | ForEach-Object {
      $VM = $_
      $VM | Get-Annotation |
        ForEach-Object {
        $Report = "" | Select-Object VM,Name,Value
        $Report.VM = $VM.Name
        $Report.Name = $_.Name
        $Report.Value = $_.Value
        $Report
      }
    } | Export-Csv -Path VMAnnotations.csv -NoTypeInformation -UseCulture
    
  • PowerCli DataStore Audit?

    Hello

    I was wondering if someone could help me with a script.  I need to perform an audit of our data with capacity warehouses, put into service and available.  I found a code snippet that returns the information I need, but is there a way to indicate these cluster data stores that are assigned to?

    Here is the code I use.

    $report
    = @() get-datastore
    
    | % { 
    $info = "" | select DataCenter, Name, Capacity, Provisioned, Available 
    $info.Datacenter = $_.Datacenter 
    $info.Name = $_.Name 
    $info.Capacity = [math]::Round($_.capacityMB/1024,2) 
    $info.Provisioned = [math]::Round(($_.ExtensionData.Summary.Capacity - $_.ExtensionData.Summary.FreeSpace + $_.ExtensionData.Summary.Uncommitted)/1GB,2) 
    $info.Available = [math]::Round($info.Capacity - $info.Provisioned,2) 
    $report += $info }
    #$report | sort Available | format-table –auto
    
    
    
    
    
    
    
    
    
    

    Ideally, I would have a spreadsheet with a spreadsheet separate for each Cluster, but having a single sheet with all data warehouses and their grouping would be nice as well.

    THX

    Try something like this

    $report = @()
    
    foreach($cluster in Get-Cluster){
        Get-VMHost -Location $cluster | Get-Datastore | %{
            $info = "" | select DataCenter, Cluster, Name, Capacity, Provisioned, Available
            $info.Datacenter = $_.Datacenter
            $info.Cluster = $cluster.Name
            $info.Name = $_.Name
            $info.Capacity = [math]::Round($_.capacityMB/1024,2)
            $info.Provisioned = [math]::Round(($_.ExtensionData.Summary.Capacity - $_.ExtensionData.Summary.FreeSpace + $_.ExtensionData.Summary.Uncommitted)/1GB,2)
            $info.Available = [math]::Round($info.Capacity - $info.Provisioned,2)
            $report += $info    }
    }
    
    $report | Export-Csv "C:\cluster-ds.csv" -NoTypeInformation -UseCulture
    

    If you have a cluster with worksheet in a spreadsheet, you can use the function of my post called beyond Export-Csv: export Xls

    The script would be slightly modified.

     foreach($cluster in Get-Cluster){
        $report = @()
        Get-VMHost -Location $cluster | Get-Datastore | %{
            $info = "" | select DataCenter, Cluster, Name, Capacity, Provisioned, Available
            $info.Datacenter = $_.Datacenter
            $info.Cluster = $cluster.Name
            $info.Name = $_.Name
            $info.Capacity = [math]::Round($_.capacityMB/1024,2)
            $info.Provisioned = [math]::Round(($_.ExtensionData.Summary.Capacity - $_.ExtensionData.Summary.FreeSpace + $_.ExtensionData.Summary.Uncommitted)/1GB,2)
            $info.Available = [math]::Round($info.Capacity - $info.Provisioned,2)
            $report += $info    }
        $report | Export-Xls -Path C:\ds-cluster.xls -WorksheetName $cluster.Name -SheetPosition "end"}
    
  • Select the list with the pagination in report Interfactive

    Hi all

    IAM using apex 3.2.1.

    IAM using interactive report, it contains 15 thousand documents. By default, only two options are there related interactive x to y and x to y of z paging. It is very difficult to find the lines of the given scope.

    In the report selection list Sql with pagination and search (defined according to the pagination) engine are provided.

    I want to use these options in my interactive report

    I f anyone knows the solution please inform me.


    Thanks in advance

    Balu

    Hello

    OK, the issue seems to be with IE.
    I try to check what I can do about it.

    I'll publish the solution later

    Kind regards
    Jari

  • Report data store

    Hello

    I am filling an HTML table with the following, but for some reason, I don't get the name of DataStoreCluster and I'm not able to filter the LUNS that have a capacity of 1 TB or more and have less than 1 TB of free space.

    $report = get-Datastore. Where-Object {$_.} Name - notMatch ("ESX |") Datastore1") - and ($_.) CapacityMB - ge "1000000")- and ($_.) (FreeSpaceMB-lt "1000000")} | %{

    New-object PSObject-property @ {}

    NOMCLUSTER = (Get-DatastoreCluster - Datastore $_ |) Select the name-ExpandProperty)

    Name = $_.name

    Capacity = ($_.) CapacityMB * 1 MB)

    Put into service = ($_.) ExtensionData.Summary.Capacity - $_. ExtensionData.Summary.FreeSpace +.

    $_. ExtensionData.Summary.Uncommitted)

    Used = ($_.) CapacityMB * 1 MB-$_. FreeSpaceMB * 1 MB)

    FreeSpace = ($_.) FreeSpaceMB * 1 MB)

    PercFree = [math]: round (100 * $_.) FreeSpaceMB / $_. CapacityMB, 2)

    }

    }    | Tri-objet-property PercFree

    $report | %{

    WriteData $_. NOMCLUSTER $_. Name $_. Capacity $_. Provisioned $_. Used $_. FreeSpace $_. PercFree

    }

    }

    Thank you

    Don't know what writedata is supposed to. Which is a function that you wrote.

    And there is a unbalanced parenthesis.

    The following works for me

    $report = get-Datastore.

    Where-Object {$_.} Name - notMatch ("ESX |") Datastore1') - and

    ($_. CapacityMB - ge 1 TB/1 MB)- and

    ($_. FreeSpaceMB - lt 1 TB/1Mo)} | %{

    New-object PSObject-property @ {}

    NOMCLUSTER = (Get-DatastoreCluster - Datastore $_ |) Select the name-ExpandProperty)

    Name = $_.name

    Capacity = ($_.) CapacityMB * 1 MB)

    Put into service = ($_.) ExtensionData.Summary.Capacity - $_. ExtensionData.Summary.FreeSpace +.

    $_. ExtensionData.Summary.Uncommitted)

    Used = ($_.) CapacityMB * 1 MB-$_. FreeSpaceMB * 1 MB)

    FreeSpace = ($_.) FreeSpaceMB * 1 MB)

    PercFree = [math]: round (100 * $_.) FreeSpaceMB / $_. CapacityMB, 2)

    }

    }    | Tri-objet-property PercFree

    $report | %{

    Write-Host $_. NOMCLUSTER $_. Name $_. Capacity $_. Provisioned $_. Used $_. FreeSpace $_. PercFree

    }

  • count the number of targets, devices and paths by hba for each host with powercli 5.5

    Hi all

    I'm writing this Question again in the community, was not able to found the answer I was looking for in the nets:

    https://communities.VMware.com/thread/516226?start=0 & tstart = 0

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

    I went through the scripts provided in the community, but seems that t not work on powercli 5.5.

    ///

    # The target account, devices and paths for each host

    Get-Cluster $cluster | Get-VMHost | Sort-Object-property name. {ForEach-Object

    $VMHost = $_

    $VMHost | Get-VMHostHba-type FibreChannel | Sort-Object-property device | {ForEach-Object

    $VMHostHba = $_

    $ScsiLun = $VMHostHba | Get-ScsiLun

    If {($ScsiLun)

    $ScsiLunPath = $ScsiLun | Get-ScsiLunPath | `

    Where-Object {$_.} Name - like "$($VMHostHba.Device) *"} ".

    $Targets = ($ScsiLunPath |) »

    Group-object - property SanID | Measure - Object). County

    $Devices = ($ScsiLun |) Measure - Object). County

    $Paths = ($ScsiLunPath |) Measure - Object). County

    }

    Else {}

    $Targets = 0

    $Devices = 0

    $Paths = 0

    }

    $Report = "" | Select-Object - property VMHost, HBA, target devices, paths

    $Report.VMHost = $VMHost.Name

    $Report.HBA = $VMHostHba.Device

    $Report.Targets = $Targets

    $Report.Devices = $Devices

    $Report.Paths = $Paths

    $Report

    }

    }

    ///

    I went through the script LucD posted below: but it's not exactly what I'm looking for.

    LucD : can you please change the same for me please.   to count the number of paths per hba for each host with powercli 5.5, devices and targets.

    //

    $esx = get-VMHost < host name >

    foreach ($hba to (VMHostHba Get - VMHost $esx - type "FibreChannel")) {}

    $target = ((get - see $hba. VMhost). Config.StorageDevice.ScsiTopology.Adapter | where {$_.} Adapter - eq $hba. Key}). Goal

    $luns = get-ScsiLun - Hba $hba - LunType 'disk '.

    $nrPaths = ($target | % {$_.}) Lun.Count} | Measure - Object - sum). Sum

    Write-Host $hba. Device ' target: ' $target. County "devices:" $luns. County ' path: ' $nrPaths

    }

    //

    I'll be grateful for any help.

    Tarun Gupta

    Try something like this

    {foreach ($esx in Get-VMHost)

    foreach ($hba to (VMHostHba Get - VMHost $esx - type "FibreChannel")) {}

    $target = ((get - see $hba. VMhost). Config.StorageDevice.ScsiTopology.Adapter | where {$_.} Adapter - eq $hba. Key}). Goal

    $luns = get-ScsiLun - Hba $hba - LunType "disk" - ErrorAction SilentlyContinue

    $nrPaths = ($target | % {$_.}) Lun.Count} | Measure - Object - sum). Sum

    $props [ordered] = @ {}

    VMHost = $esx.name

    HBA = $hba. Name

    Target = $target. County

    Device = $luns. County

    Path = $nrPaths

    }

    New-object PSObject-property $props

    }

    }

  • PowerCLI script to display the number of vCPU by VMhost use

    Hi all

    I'm looking to get help here with powerCLI script to list each total number of ESXi vCPU host that is used to determine if there are any ESXi host CPU is more engaged.

    According to suggestion of performance in some blog vExpert, is around 1: 3 of Jepp core ratio: vCPU allocated, then how to display the report with the powerCLI for something like this:

    PRODESXi01
    Total of nuclei available: 32
    Used by the virtual machine: 28

    PRODESXi02
    Total of nuclei available: 32
    Used by the virtual machine: 38

    So according to the result above, the PRODESXi02 is more committed by 6vCPU allocated to the virtual machine.

    Note: The available total carrots is taken from the value of logical processors from the contents tab, when you click on the vSphere console.

    How to get this report using PowerCLI?

    Thank you

    You mean something like this?

    {Foreach ($esx in Get-VMHost)

    $vCPU = get-VM-location $esx | Measure-object-property NumCpu-sum | Select - ExpandProperty sum

    $esx | Select Name,@{N='pCPU'; E={$_. NumCpu}},

    @{N = 'vCPU'; E = {$vCPU}},

    @{N = "Ratio"; E = {[math]: Round ($vCPU / $_.)} (NumCpu, 1)}}

    }

Maybe you are looking for