How to get the number of LUN to physical RDM assigned to VM?

Hi people,

Is it possible to get the LUN ID or number of a RDM physical disk attached to a virtual from Windows using PowerCLI machine?

Thank you.

Hi Albert,

the first PowerCLI script will give the LUN ID or the number of physical RDM disks attached to a virtual machine for ESX 3.5 servers:

Get-VM | `
Get-HardDisk | `
Where-Object {$_.DiskType -eq "RawPhysical"} | `
Select-Object -Property @{N="VM";E={$_.Parent}},
  @{N="HardDisk";E={$_.Name}},
  @{N="Lun";E={$_.ScsiCanonicalName.Split(":")[-1]}}

The second script PowerCLI will give you the LUN ID or number of a RDM physical disk attached to a virtual machine for 4 ESX servers:

Get-VM | `
Get-HardDisk | `
Where-Object {$_.DiskType -eq "RawPhysical"} | `
Select-Object -Property @{N="VM";E={$_.Parent}},
  @{N="HardDisk";E={$_.Name}},
  @{N="Lun";E={
    $HardDisk = $_
    $lun = Get-VMHost -VM $_.Parent | `
      Get-ScsiLun -LunType Disk | `
      Where-Object {$_.CanonicalName -eq $HardDisk.ScsiCanonicalName}
    [int](Select-String ":L(?\d+)$" `
        -InputObject $lun.RuntimeName).Matches[0].Groups['lunID'].Value
  }}

Thanks to Luke for his blog post the making of a New VIProperty called Monday who gave me the idea for the regular expression.

Best regards, Robert

Post edited by: RvdNieuwendijk

Tags: VMware

Similar Questions

  • How to get the number of fonts online

    Hi all

    can you give me solution to the following:

    How to get the number of fonts on a line.

    Ex

    BlackBerry Support 'Community' is supported for my career

    in this line, I want to ITALIC for the word 'Community '.

    Font.GetDefault (). Derive from wil give for total line...

    RichTextField does not?

    See this KB article

    http://supportforums.BlackBerry.com/T5/Java-development/format-text-in-a-RichTextField/Ta-p/445038

  • How to get the number of entries in the navigation menu?

    boc.bmp

    How to get the number of entries in the navigation menu? Check the image. What it shows 8 number of customers and 10 products and 10 orders in the list. How to get it?

    --

    Thank you

    Hello

    Create items of the request saying, "CUSTOMERS", "PRODUCTS" and "ORDERS".

    Create the application process that defines these items when loading the page for example

    C1 in select count (*) NTC (of customer_table)

    loop

    : CUSTOMERS: = c1.cnt;

    end loop;

    C1 in select count (*) NTC (of products_table)

    loop

    PRODUCTS: = c1.cnt;

    end loop;

    C1 in select count (*) NTC (of orders_table)

    loop

    : ORDERS: = c1.cnt;

    end loop;

    Components shared Open-> Navigation bar and change:

    In the entry list Label-> customers & CLIENTS.]

  • How to get the number of bits of Windows?

    Hi all

    How can I get the number of bits of Windows, the application of the LV is running on?

    By using the disabled conditional structure, I can get the number of bits of the application (if it is built in BT 32 or 64), but not the number of bits of windows.

    Thank you

    system variable 'PROCESSOR_ARCHITECTURE '?

  • How to get the number of line of a multi-line string

    It seems that this Panel of string does not provide the tool to get the chain line number,

    Does anyone have the same experience?

    so...

    How to get the line number of a variable string?

    Number of lines

  • How to get the number and the name of the contacts selector

    Hi all

    I got the Contact Picker work but I have no idea how to get the selected telephone number and the name.

    There are attributes that I can put like contactId.value () to retrieve or there is another way?

    Thanks in advance.

    ImageButton{
                        defaultImageSource: "asset:///images/bluebutton.png"
                        onClicked: {
                            contactPicker.open();
                        }
                        attachedObjects: [
                            ContactPicker {
                                id: contactPicker
                                onContactSelected: {
                                    result.text = "You chose contact: " + contactId;
                                }
                            }
                        ]
    
                    }
    
                    Label {
                        id: result
                        text: "You chose contact: "
                    }
    

    Hello

    You can get the contact name and phone number as this,

    ImageButton{
                        defaultImageSource: "asset:///images/bluebutton.png"
                        onClicked: {
                            contactPicker.open();
                        }
                        attachedObjects: [
                            ContactPicker {
                                id: contactPicker
                                onContactSelected: {
                                    result.text = "You chose contact: " + contactId;
    // call a cpp method to get the details
    
    app.getDetails(contactId); } } ] } Label { id: result text: "You chose contact: " }
    

    the CPP code:

    void ContactDetails(ContactId id)
    {
    Contact contact_info = m_contactService->contactDetails(id);
    
        QString firstName = contact_info.firstName();
        QString lastname = contact_info.lastName();
            QList phoneno_list = contact_info.phoneNumbers();
    
        QStringList no_s;
    
        foreach(ContactAttribute attr, phoneno_list)
        {
            no_s << attr.value();
        }
    }
    

    You can get details like this.

    Kind regards

    Naresh Kodumuri.

  • VMware View | PowerCLI | How to get the number of virtual machine in a specific pool-ID

    Hello

    Generally, to get the number of VMS in a pool, I run this command:

    Get-pool | Select Pool_id, @{Name = "NumVM"; Expression = {($_ |)} (Get - DesktopVM). County}} | out-gridview

    But how can I list all the pools and then select the pool I want a county of?

    Maybe something like:

    Select 1 for accounts

    Select 2 for Marketing

    and then County VM just for this pool and immediate where at the output (Out-gridview or Export-CSV)

    Thanks, Julien

    Hi LucD

    I don't understand the line:

    1.. $pools. County | %{
    Write-Host "$_" $Pools [$_ - 1]. Name

    Why do we need the 1...

    Also is the same as get-get-resourcepool pool?

    Thanks, Julien

  • How to get a number of LUNs of StorageDeviceInfo property to connect a nomperipherique or DevicePath?

    Hello

    I'm new in powershell script and I have a basic question. I try to get a number of LUNS on a drive connected to an ESX Server. I want it because I want to add a row to a virtual machine disk but in vsphere, it should be noted the unique device name. So I want to easily identify the rdm LUN to match the number of LUNS with the name of the device in the StorageDeviceInfo property.

    Anyone know an easy way to do it?

    Thank you

    Sylvain

    The following script produces a report with the information you need (I think).

    $hostStor = Get-VMHost  | Get-VMHostStorage | Get-View
    
    $hba = @{}
    $hostSTor.StorageDeviceInfo.HostBusAdapter | %{
         $hba[http://$_.Key|http://$_.Key] = $_
    }
    $lun = @{}
    $hostSTor.StorageDeviceInfo.ScsiLun | %{
         $lun[http://$_.Key|http://$_.Key] = $_
    }
    
    $report = @()
    $hostStor.StorageDeviceInfo.ScsiTopology.Adapter | %{
         $hbaDevice = $hba[http://$_.Adapter|http://$_.Adapter].Device
         $_.Target | %{
              $targetNumber =  $_.Target
              $_.Lun | %{
                   $row = "" | Select hbaDevice, targetNumber, lunNumber, lunDeviceName
                   $row.hbaDevice = $hbaDevice
                   $row.targetNumber = $targetNumber
                   $row.lunNumber = $_.Lun
                   $row.lunDeviceName = $lun[http://$_.ScsiLun|http://$_.ScsiLun].DeviceName
                   $report += $row
              }
         }
    }
    $report
    

    Since there are some hooks in the script, I have attached the script as a file as well.

  • How to get the number in the format "999,999,999.000" in oracle

    Hi friends,
    How can I get the number entered in the format '999,999,999.000 '...
    for example, if my number has 1900, it should give 1,900.000
    If my number is 10000, then it should give me 10,000.000 like this in sql
    is there a function available for this?

    pls help

    Thank you

    Hello

    Check below hope it solves your problem.

    SQL> SELECT TRIM(TO_CHAR(1900, '999,999,999,999,999.99')) FROM DUAL;
    
    TRIM(TO_CHAR(1900,'999,999,999
    ------------------------------
    1,900.00
    SQL> SELECT TRIM(TO_CHAR(10000, '999,999,999,999,999.99')) FROM DUAL;
    
    TRIM(TO_CHAR(10000,'999,999,99
    ------------------------------
    10,000.00
    
    SQL> 
    

    Concerning
    Ameya

  • Requirement of Beeping - how to get the number of combination of several columns

    Hi gurus, Experts and all,.

    Help me please how this code to the BEEP.

    I need to get the number of each combination of 6 columns if the combination is repeated.

    Columns example: number team responsible for Group Type reason
    The example columns: placed Team1 M1 M1 T1 won 2
    GroupA Team1 H2 M2 T1 loss 1
    GroupB Team2 H2 M3 T2 won 1
    GroupB Team2 H3 M3 T2 loss 2

    Thank you very much

    Jean Paul
    BEEP newbie

    Published by: user10955574 on October 28, 2010 20:15

    Published by: user10955574 on October 29, 2010 03:06

    I sent you the file. Check your mailbox.

  • How to get the number of items in a tilelist

    I write for a flex using FlexSelenium application test scenarios and I need to get the number of items in the tilelist component.

    I know that the tilelist is powered by a table. but I can not access this table of my test scenario.

    Can someone tell me how I can get the number of items in a tilelist on the application? What property of the tilelist can provide this number?

    Try tileList.dataProvider.length;

  • How to get the number of lines in a region of report

    Hi all

    Is there a way to get the number of rows returned in a report region, without issuing an another 'select count (*) from une_table?
    I mean something like the substitution string #ROW_NUM # but for the total of the lines.

    Thank you

    Pedro.

    http://download.Oracle.com/docs/CD/E17556_01/doc/user.40/e15517/UI.htm#CHDDGGEG

    For parts of classic report, the footer region supports the following substitution strings:

    #ROWS_FETCHED # indicates the number of lines read by the reporting engine Oracle Application Express (the size of the page). You can use these substitution strings to display messages to the user. For example:

    Read #ROWS_FETCHED # #TIMING # seconds lines.

    * #TOTAL_ROWS # displays the total number of rows that satisfy an SQL query used for a report.

    #FIRST_ROW_FETCHED # and #LAST_ROW_FETCHED # show the range of displayed lines. For example:

    Until #FIRST_ROW_FETCHED # by #LAST_ROW_FETCHED # of #ROWS_FETCHED # displayed >

    Van
    Trent

  • How to get the number of records printed for the report in the dashboard

    Hello

    I would like to get the number of records printed at the bottom of each report as dashboard:
    < 1-25 of 6300 > instead of < 1-25 >

    Any help is appreciated
    Concerning
    B

    Hello

    Check out the blog of Miky Schreiber;

    http://www.miky-Schreiber.com/blog/permalink, guid, e964552b-eb6e-449b-b2c6-42adea2376cd.aspx

    Good luck

    Daan Bakboord
    http://obibb.WordPress.com

  • How to get the internal values of Photoshop one ID assigned

    I have difficulties to obtain values for the internal settings.  It's less hard to set, you can use the Listener Script to get the code to use.  Presumably, you use executeActionGet() with an ActionReference.  The problem is to know how to build the ActionReference.  It doesn't seem to be a lot of documentation on that.

    My immediate problem is how to get the parameters of the 3D camera. I know this requires Photoshop Extended, but the principle must be the same.  This code sucessfully defines these parameters:

    < code >

    function setPhotoshopCamera (angleX, angleY, angleZ, posX, posY, posZ) {}
    Camera
    var idGet3DCamera = stringIDToTypeID ("get3DCamera");
    var idSet3DCamera = stringIDToTypeID ("set3DCamera");
    var descCamera = new ActionDescriptor();

    Camera position
    var idKey3DCurrentCameraPosition =
    stringIDToTypeID ("key3DCurrentCameraPosition");
    var descCameraPosition = new ActionDescriptor();

    var idkeythreeDXPos = stringIDToTypeID ("key3DXPos");
    descCameraPosition.putDouble (idkeythreeDXPos, posX);
    var idkeythreeDYPos = stringIDToTypeID ("key3DYPos");
    descCameraPosition.putDouble (idkeythreeDYPos, posY);
    var idkeythreeDZPos = stringIDToTypeID ("key3DZPos");
    descCameraPosition.putDouble (idkeythreeDZPos, posZ);
    var idkeythreeDXAngle = stringIDToTypeID ("key3DXAngle");
    descCameraPosition.putDouble (idkeythreeDXAngle, angleX);
    var idkeythreeDYAngle = stringIDToTypeID ("key3DYAngle");
    descCameraPosition.putDouble (idkeythreeDYAngle, angleY);
    var idkeythreeDZAngle = stringIDToTypeID ("key3DZAngle");
    descCameraPosition.putDouble (idkeythreeDZAngle, angleZ);
    descCamera.putObject (idKey3DCurrentCameraPosition,
    (idKey3DCurrentCameraPosition, descCameraPosition);

    These must be defined in the ActionDescriptor to make it work,

    // , but we do not have them
    var idkeythreeDCurrentFStop = stringIDToTypeID ("key3DCurrentFStop");
    descCamera.putDouble (idkeythreeDCurrentFStop, 0.000000);
    var idkeythreeDCurrentFDist = stringIDToTypeID ("key3DCurrentFDist");
    descCamera.putDouble (idkeythreeDCurrentFDist, 0.500000);
    var idkeythreeDCurrentFocalPointX = stringIDToTypeID ("key3DCurrentFocalPointX");
    descCamera.putDouble (idkeythreeDCurrentFocalPointX, 0.500000);
    var idkeythreeDCurrentFocalPointY = stringIDToTypeID ("key3DCurrentFocalPointY");
    descCamera.putDouble (idkeythreeDCurrentFocalPointY, 0.500000);
    var idkeythreeDCurrentFOV = stringIDToTypeID ("key3DCurrentFOV");
    descCamera.putDouble (idkeythreeDCurrentFOV, 30.000000);
    var idkeythreeDOrthographic = stringIDToTypeID ("key3DOrthographic");
    descCamera.putBoolean (idkeythreeDOrthographic, false);
    var idkeythreeDOrthographicScale = stringIDToTypeID ("key3DOrthographicScale");
    descCamera.putDouble (idkeythreeDOrthographicScale, 6.928203);
    var idkeythreeDViewIndexString = stringIDToTypeID ("key3DViewIndexString");
    descCamera.putString (idkeythreeDViewIndexString, "");
      


    var / / desc = executeAction (idSet3DCamera, descCamera, DialogModes.ALL);
    return of ESCR;
    }

    < code >

    The problem is that it does not work unless you also set the lower elements.  I want to leave what they are currently defined, but I don't know how to get these values.  Apart from that, I'll get the values of position of camera beforehand.  9 ID, string or otherwise, this should be necessary are known from the top.

    I assume you are using something like:

    < code >

    Var ref = new ActionReference();
    ref.putIndex (idkeythreeDCurrentFStop, idkeythreeDCurrentFStop);
    var / / desc = executeActionGet (ref);
    < code >

    However, I was unable to get something to work.  I am not sure

    1. That of the putXXX method to use.
    2. What to use for the desiredClass, which is the first argument.

    Any help would be appreciated.

    That you will get the 3DCurrentCameraPositon

    var ref = new ActionReference();
    ref.putEnumerated( zTID("Lyr "), zTID("Ordn"), zTID("Trgt") );
    var desc = executeActionGet(ref).getObjectValue(stringIDToTypeID('layer3D')).getObjectValue(stringIDToTypeID('key3DState')).getObjectValue(stringIDToTypeID('key3DCurrentCameraPosition'));
    

    Which returns a descriptor with the following keys.

    Key 0 = key3DXPos: DescValueType.DOUBLETYPE
    1 key = key3DYPos: DescValueType.DOUBLETYPE
    2 = key3DZPos key: DescValueType.DOUBLETYPE
    3 = key3DXAngle key: DescValueType.DOUBLETYPE
    Key 4 = key3DYAngle: DescValueType.DOUBLETYPE
    5 = key3DZAngle key: DescValueType.DOUBLETYPE

    At least with my sample 3D layer. I don't really do a lot with the 3D, so there may be other keys.

  • How to get the number of occurrences per document

    Hello

    I have a table of documents (word, pdf, excel, txt) stored in the blob column. I want the SCORE to returns the number of occurrences in each document, so I use this piece of code:

    SELECT bdt.*, score_1, DBMS_CRYPTO SCORE (1). HASH(Archivo, 3) AS cod_hash

    OF crg_ctx_archivos_recibidos bdt

    WHERE CONTAINS

    (archivo,

    ' < query >

    < textquery = grammar 'SPANISH' lang = 'CONTEXT' > DEFINESCORE (paz, OCCURRENCE * 0.1) < / textquery >

    < score datatype = "INTEGER" algorithm = "COUNT" / >

    < / query > ', 1

    ) > 0

    ORDER BY PARTITION (1) DESC;

    However, I get a maximum score of 10, but I know that one of these documents have 490 games. How can I get the exact number of matches by document?

    Thanks in advance

    PD. I am using Oracle 11.2

    All the scores at the top inside to 100, so I don't think that you will be able to make the distinction between a document with 100 matches and the other with 490.

    Can you explain what you're trying to do with this?  There may be a way to use text search to find all docs with at least 100 shots, then their post-processing to order by the real number.

Maybe you are looking for