Get-VirtualPortGroup - trying to get only the groups of ports attached to a switch.

I've got the following as part of a script, that I'm working on.  I'm willing to all the port groups on the VMSwitch on all servers in the list.

ForEach($objHost in $ObjAllHosts){
$strVSwitch = Get-Virtualswitch -VMHost (Get-VMHost $objHost) | where-object { $_.Name -match "VMswitch" }
$objPortGroups = Get-VirtualPortGroup -VMHost (Get-VMHost $objHost) -VirtualSwitch $strVSwitch | Sort-Object -Property Name
}

The problem is that this does not seem to fill the $objPortGroups variable. Point of supply and investigating further, I saw that:

Get-VirtualPortGroup -VMHost (Get-VMHost $objHost) -VirtualSwitch $strVSwitch

Gives me a list of all the port groups, on all switches.

Get-VirtualPortGroup -VMHost (Get-VMHost $objHost) | Where-Object {$_.VirtualSwitch -match "VMSwitch"} 

Gives me nothing.

Get-VirtualPortGroup -VMHost (Get-VMHost $objHost) | Where-Object {$_.VirtualSwitch -like "*"} 

Gives me all ports on all switches groups, considering that:

Get-VirtualPortGroup -VMHost (Get-VMHost $objHost) | Where-Object {$_.VirtualSwitch -like "VM*"} 

Gives me nothing.

Is there something special about the. VirtualSwitch property that prevents from functioning correctly?  Is there another way to get a list of the groups of virtual ports on 'VMSwitch' and not vSwitch0 and vMotion?

I think the name of the property in the VirtualPortGroupImpl object that you want is VirtualSwitchName not VirtualSwitch.

Tags: VMware

Similar Questions

  • Uninstalled Potoshop Elements 7 on my old PC. Tried to install on the new PC, you get only "the code you entered is invalid." How can I install on my new PC, it's bought and paid for and if I look at my account, it is there. Could not find any e-mailadres

    Uninstalled Potoshop Elements 7 on my old PC. Tried to install on the new PC, you get only "the code you entered is invalid." How can I install on my new PC, it's bought and paid for and if I look at my account, it is there. Cannot find any e-mailadress support. What should I do?

    Error "serial number is not valid for this product". Creative Suite

    http://helpx.Adobe.com/Creative-Suite/KB/error-serial-number-valid-product.html

    Find the serial number of your Adobe product quickly

  • Get only the Apple logo on my iPhone 5 s

    I get only the Apple logo on the iPhone 5 s.  Tried to update and restore through iTunes but it would not be completed that.

    Hello

    On the computer, make sure that iTunes is up to date.

    Mac

    1. Open iTunes.
    2. In the MenuBar at the top of your computer screen, choose iTunes > check for the updates.
    3. Follow the prompts to install the latest version.

    Windows

    1. Open iTunes.
    2. In the MenuBar at the top of the iTunes window, choose Help > check for updates. Learn what to do If you see not the menu bar.
    3. Follow the prompts to install the latest version.
  • Suppose I have a table emp that has thousands of lines of data. In this table, I have to get only the employees whose salary is equal.

    Hello world

    Suppose I have a table emp that has thousands of lines of data. In this table of employees receive wages between 1000-10000.

    Now I have to get only the employees whose salary is equal.

    for example

    empNo empName sal

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

    1 ram 5000

    2 5000 Shyam

    3 1000 Dilip

    4 deepak 2000

    5 sisi 1000

    6 1000 Priya

    so now...

    Now without using ' select * from emp where Sal IN (5000,1000). "How can I get these employees with the same salary?

    SELECT *.

    EMP e1

    WHERE EXISTS (SELECT 99 FROM emp e2 WHERE e2.sal = e1.sal AND e2.empno! = e1.empno)

    or maybe

    SELECT *.

    WCP

    WHERE sal IN (SELECT sal FROM emp GROUP BY sal HAVING COUNT (*) > 1)

  • When I launch Firefox, I get only the bottom of my browser in the Firefox window. I have already reinstalled it, but it does not solve the problem.

    When I launch Firefox, I get only the bottom of my browser in the Firefox window. I have the normal window for 1 second, but it changes in the background window only. So, without the toolbar or navigation. I have already reinstalled it, but it does not solve the problem.

    Hello jonson00, please follow the troubleshooting steps in Firefox opens with a white or transparent window. If this solves the problem, it would be also interesting including the extension has a problem in your case. Thank you!

  • I've lost the main screen for photoshop! I don't know what I did, but now when I open photoshop, I get only the tool bar at the top and a little on the sides. How can I go back to the normal screen?

    I've lost the main screen for photoshop! I don't know what I did, but now when I open photoshop, I get only the tool bar at the top and a little on the sides. How can I go back to the normal screen?

    Hi renaeb,

    Would you go to the Windows menu in Photoshop and check the option framework application from the drop-down list.

    Concerning

    Sarika

  • How to get only the whole ticks on a horizontal axis of a graph?

    Hello
    Could someone help me find oout how to get only the whole ticks on a horizontal axis of a graph?
    When I have a number less than 5, I get like 0, 0.2, 0.4 ticks... while I want it to be 0, 1, 2...

    Thank you
    Yann

    healer

    Try this Clara. Put this inbetween your chart labels:



    Set the interval to meet your needs of 'tick '.

  • How to get only the year of a date?

    I try to shoot only the year of a date and does not know how this can be done. I tried the SUBSTR function but its does not not how I think. What I want to do, it is write a condition indicating the year of birth of point = current year minus 23, I have a calc than the figures of the age of the difference in the date of birth and the current year, but I'd really like to just write a condition based just a years. Is this possible?

    Hello
    SUBSTR only works on a string. To extract parts of a date, you must use the TO_CHAR command.

    For the year, you would use this: TO_CHAR (the_date, 'YYYY')

    To_char takes 2 switches, the date to be handled and the part to be extracted, with the portion between apostrophes.

    Once you get used to manipulate dates as this other common areas are: DD - extracts the day of the month, MY snippet code to 3 characters for the month.

    For example, you can use this: TO_CHAR(sysdate,'DD-MON-YYYY') and it converts the current date, June 7, 2012 to June 7, 2012

    Hope this helps
    Best wishes
    Michael

  • I recently changed my IE but when I try to import the Favorites I get only the first two files. How can I get my favorite of all THE? s

    I followed the advice and imported IE Favorites, but only the first two files have met. How can I get all THE files across please?

    Wow. I think I will like Firefox if the aid is so easily available, quick and as good as this. Fixed right away
    Thank you very much
    Kevod

  • Get only the alphanumeric column numbers

    Hi all

    How can I get to the numbers in the alphanumeric column?
    I use the following question for this.


    with tab as)
    Select 25 - Abc' key1 of union double all the
    Select 233 - xyz' key1 of union double all the
    Select 'x23A' key1 in union double all the
    Select 91 w-2-dd-2' double key1
    )
    tab, select regexp_substr(key1,'[[:digit:]]+')


    But here the last row (91-w-2-dd-2) returns only two first digits (91). But I need 9122.
    My version of oracle's 10g release 2.

    Thank you
    Sujnan

    This can do

    Processing ...
    with tab as (
    select '25-Abc' key1 from dual union all
    select '233-xyz' key1 from dual union all
    select 'x23A' key1 from dual union all
    select '91-w-2-dd-2' key1 from dual
    )
    select regexp_replace(key1,'[^0-9]+','') from tab
    Query finished, retrieving results...
                            REGEXP_REPLACE(KEY1,'[^0-9]+','')
    --------------------------------------------------------------------------------
    25
    233
    23
    9122                                                                             
    
    4 row(s) retrieved
    

    Alessandro Bye

  • How to get only the new lines

    Hello

    I have a table as below

    emp_id (integer)
    id_est (integer)
    dt_est (date)

    for each emp_id I have several id_est with several dt_est... as below

    emp_id id_est dt_est
    1 1 10-01 - 2009
    1 2 2009 - 01 - 13
    2 3 2009 - 01 - 10
    2 4 2009 - 01 - 12
    2 5 2009 - 01 - 14
    3 6 2009 - 01 - 12
    4 7 2009 - 01 - 15
    5 8 2009 - 01 - 17
    5 9 2009 - 01 - 19

    I would get just the news lines function date each emp_id, so my result should be as below

    emp_id id_est dt_est
    1 2 2009 - 01 - 13
    2 5 2009 - 01 - 14
    3 6 2009 - 01 - 12
    4 7 2009 - 01 - 15
    5 9 2009 - 01 - 19

    How I do that?

    Thank you

    Hello

    Try this code.

    Salim cordially.

    SELECT   id_emp, MAX (id_est), MAX (dt_est)
        FROM t
    GROUP BY id_emp
    
  • analysis to get only the first node of the XML.

    Hello
    I'm trying to parse the following xml tag. I want only the first node in the ORDER_PAYMENT_DETAIL element, and then the other node element.
    I would appreciate your help.

    ---
    < ORDER_PAYMENTS >
    < ORDER_PAYMENT >
    < ORDER_NO > 20000404 < / ORDER_NO >
    < PAYMENT_METHOD_ID > 5 < / PAYMENT_METHOD_ID >
    < PAYMENT_SEQ_NO > 0 < / PAYMENT_SEQ_NO >
    < CHARGE_AMOUNT > 50 < / CHARGE_AMOUNT >
    USD < CHARGE_CURRENCY > < / CHARGE_CURRENCY >
    < ORDER_PAYMENT_DETAILS >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 2 < / ATTRIBUTE_ID >
    Test1 < ATTRIBUTE_VALUE > < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 1 < / ATTRIBUTE_ID >
    < ATTRIBUTE_VALUE > CC < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 3 < / ATTRIBUTE_ID >
    < > 4222222222222 ATTRIBUTE_VALUE < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 4 < / ATTRIBUTE_ID >
    < > 01 ATTRIBUTE_VALUE < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 5 < / ATTRIBUTE_ID >
    < > 2012 ATTRIBUTE_VALUE < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 10 < / ATTRIBUTE_ID >
    < ATTRIBUTE_VALUE > AP53-7457490 < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < > 11 ATTRIBUTE_ID < / ATTRIBUTE_ID >
    ID575754W34623525SDT < ATTRIBUTE_VALUE > < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < > 12 ATTRIBUTE_ID < / ATTRIBUTE_ID >
    KEY111222333444555FSDRT < ATTRIBUTE_VALUE > < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 2 < / ATTRIBUTE_ID >
    Test2 < ATTRIBUTE_VALUE > < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 1 < / ATTRIBUTE_ID >
    < ATTRIBUTE_VALUE > CC < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 3 < / ATTRIBUTE_ID >
    < ATTRIBUTE_VALUE > 4444444444444448 < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 4 < / ATTRIBUTE_ID >
    < > 02 ATTRIBUTE_VALUE < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 5 < / ATTRIBUTE_ID >
    < > 2013 ATTRIBUTE_VALUE < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 10 < / ATTRIBUTE_ID >
    < ATTRIBUTE_VALUE > AP53-7457490 < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < > 11 ATTRIBUTE_ID < / ATTRIBUTE_ID >
    ID575754W34623525SDT < ATTRIBUTE_VALUE > < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < > 12 ATTRIBUTE_ID < / ATTRIBUTE_ID >
    KEY111222333444555FSDRT < ATTRIBUTE_VALUE > < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < / ORDER_PAYMENT_DETAILS >
    < / ORDER_PAYMENT >
    < ORDER_PAYMENT >
    < ORDER_NO > 20000404 < / ORDER_NO >
    < PAYMENT_METHOD_ID > 1 < / PAYMENT_METHOD_ID >
    < PAYMENT_SEQ_NO > 1 < / PAYMENT_SEQ_NO >
    < CHARGE_AMOUNT > 10.47 < / CHARGE_AMOUNT >
    USD < CHARGE_CURRENCY > < / CHARGE_CURRENCY >
    < ORDER_PAYMENT_DETAILS >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 2 < / ATTRIBUTE_ID >
    Test1 < ATTRIBUTE_VALUE > < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 1 < / ATTRIBUTE_ID >
    < ATTRIBUTE_VALUE > CC < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 3 < / ATTRIBUTE_ID >
    < > 4222222222222 ATTRIBUTE_VALUE < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 4 < / ATTRIBUTE_ID >
    < > 01 ATTRIBUTE_VALUE < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 5 < / ATTRIBUTE_ID >
    < > 2012 ATTRIBUTE_VALUE < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 10 < / ATTRIBUTE_ID >
    < ATTRIBUTE_VALUE > AP53-7457490 < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < > 11 ATTRIBUTE_ID < / ATTRIBUTE_ID >
    ID575754W34623525SDT < ATTRIBUTE_VALUE > < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < > 12 ATTRIBUTE_ID < / ATTRIBUTE_ID >
    KEY111222333444555FSDRT < ATTRIBUTE_VALUE > < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 2 < / ATTRIBUTE_ID >
    Test2 < ATTRIBUTE_VALUE > < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 1 < / ATTRIBUTE_ID >
    < ATTRIBUTE_VALUE > CC < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 3 < / ATTRIBUTE_ID >
    < ATTRIBUTE_VALUE > 4444444444444448 < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 4 < / ATTRIBUTE_ID >
    < > 02 ATTRIBUTE_VALUE < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 5 < / ATTRIBUTE_ID >
    < > 2013 ATTRIBUTE_VALUE < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < ATTRIBUTE_ID > 10 < / ATTRIBUTE_ID >
    < ATTRIBUTE_VALUE > AP53-7457490 < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < > 11 ATTRIBUTE_ID < / ATTRIBUTE_ID >
    ID575754W34623525SDT < ATTRIBUTE_VALUE > < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < ORDER_PAYMENT_DETAIL >
    < > 12 ATTRIBUTE_ID < / ATTRIBUTE_ID >
    KEY111222333444555FSDRT < ATTRIBUTE_VALUE > < / ATTRIBUTE_VALUE >
    < / ORDER_PAYMENT_DETAIL >
    < / ORDER_PAYMENT_DETAILS >
    < / ORDER_PAYMENT >
    < / ORDER_PAYMENTS >

    Do you mean the full xml, excluding all the ORDER_PAYMENT_DETAIL elements, but the first?

    SQL> select deletexml(colx,'//ORDER_PAYMENT_DETAIL[position()>1]').extract('/*')
      2  from tabx;
    
    DELETEXML(X,'//ORDER_PAYMENT_DETAIL[POSITION()>1]').EXTRACT('/*')
    -------------------------------------------------------------------------------
    
      
        20000404
        5
        0
        50
        USD
        
          
            2
            test1
          
        
      
      
        20000404
        1
        1
        10.47
        USD
        
          
            2
            test1
          
        
      
    
    

    Note that the ".extract('/*')" is there only for the formatting...

    Max
    http://oracleitalia.WordPress.com

  • How can I get only the url to display in the address drop down not the description of the site also?

    When only the url is displayed in the address list, it is much cleaner and easier to read, as in earlier versions.

    Add code to the file userChrome.css below default @namespace.

    @namespace url("https://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    
    .ac-title-box { display:none !important; }
    

    The file userChrome.css (UI) customization and userContent.css (Web sites) are located in the folder of chrome in the Firefox profile folder.

    See also:

  • Get only the update field

    Hello

    I use apex 5.0 with 12 c db,

    In a tabular presentation, there is an element of the checkbox. How do I know that this point be changed so I can update only the changed fields.

    Best regards

    Hello

    Apex$ row_selector try it please see

    https://docs.Oracle.com/database/121/HTMDB/concept_sub.htm#CHDGJFII

  • Can we get only the number of SQL varchar column?

    Hi all

    I have a table as below.

    CREATE TABLE TEST21 (COLUMN-NAME VARCHAR2 (30));

    INSERT INTO TEST21 VALUES ('23');

    INSERT INTO TEST21 VALUES ('32569');

    INSERT INTO TEST21 VALUES ('JAGAN");

    INSERT INTO TEST21 VALUES ('12JAGAN2');

    Now I NEED the DATA that contains only the digit.

    SELECT * FROM TEST21 where... (PROPOSAL BY CONDITION);

    COLUMN-NAME

    -----------

    23

    32569

    So is it possible?

    Hello

    select * from test21
    where regexp_instr(col_name,'[[:alpha:]]') = 0
    ;
    
    COL_NAME
    ------------------------------
    23
    32569
    

Maybe you are looking for