Get different results even script according to what VM it hits?

Hello.

IM starting to Powershell and PowerCLI, so you will know at what level it is on =)

I get different results depending on what VM my script hits (whetever they may or may not have more than one drive). I do not understand how I can fix this...

For example, I created 4 new virtual machines.

TestVMfirst1 have only a single drive

TestVM02 have 2 drives

TestVM03 have 3 discs

TestVM04 have only a single drive

My goal is to get a CSV with all disks included. I want the name, the data store and SizeGB, this info I get from Get-hard drive.

When I run my script to select all 4 virtual machines:

$VMs = get-cluster-name kluster01 : get-vm-name TestVM *

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

$VMs = get-cluster-name kluster01 | Get-vm-name TestVM *.

$Results = @)

{foreach ($VM to $VMs)

$Result = new-object PSObject

$Result | Add-Member - membertype NoteProperty-name 'Name' - value $VM. Name

$VMDiskCount = 1

Get-$VM hard drive | {foreach}

$disk = $_

$Result | Add-Member-'Disc ($VMDiskCount) name' name-value $disk. Name - membertype NoteProperty

$Result | Add-Member-name '($VMDiskCount) Datastore disk' - value $disk. Filename.Split(']') [0]. TrimStart('[') - membertype NoteProperty

$Result | Add-Member-name 'Disk ($VMDiskCount) SizeGB' - value ([math]: round ($disk.) CapacityKB / 1 MB))-membertype NoteProperty

$VMDiskCount ++

}

$Results += $Result

}

$Results | Select-object * | format-table

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

I get the result with max 1 disc:

Name(1) name of discDisk data store (1)SizeGB disc (1)
--------------------------------------------
TestVMfirst1Hard drive 1DS-20140
TestVM02Hard drive 1DS-20140
TestVM03Hard drive 1DS-20140

But if I run the same thing but with TestVM0 * (selects 4-2 VMs):

$VMs = get-cluster-name kluster01 | Get-vm-name TestVM0 *.

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

$VMs = get-cluster-name kluster01 | Get-vm-name TestVM0 *.

$Results = @)

{foreach ($VM to $VMs)

$Result = new-object PSObject

$Result | Add-Member - membertype NoteProperty-name 'Name' - value $VM. Name

$VMDiskCount = 1

Get-$VM hard drive | {foreach}

$disk = $_

$Result | Add-Member-'Disc ($VMDiskCount) name' name-value $disk. Name - membertype NoteProperty

$Result | Add-Member-name '($VMDiskCount) Datastore disk' - value $disk. Filename.Split(']') [0]. TrimStart('[') - membertype NoteProperty

$Result | Add-Member-name 'Disk ($VMDiskCount) SizeGB' - value ([math]: round ($disk.) CapacityKB / 1 MB))-membertype NoteProperty

$VMDiskCount ++

}

$Results += $Result

}

$Results | Select-object * | format-table

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

I get this result:

Name(1) name of discDisk data store (1)(1) name of the disc SizeGB disc (2).Disk data store (2)SizeGB disc (2)
-------------------------------------------- ----------------------------------------
TestVM02Hard drive 1DS-201Hard 40 2 discDS-20110
TestVM03Hard drive 1DS-201Hard 40 2 discDS-20210
TestVM04Hard drive 1DS-20140

I miss all my disks on TestVM03, I seems that the first VM sets the limit on how many records can be issued in the table... A dirty solution is to create a model on the first target VM disks, but it seems the wrong way to solve my problem.

Thanks in advance

You're conclusion is correct, I'm afraid, the first line determines how many properties, you will see.

Alternatively, you can sort the lines on the number of properties in descending order.

Something like that

$Result | Tri-objet-property {($_ |)} Get - Member). {Count of}-descending | Format-Table

Tags: VMware

Similar Questions

  • using the same search terms on ebay, getting different results on firefox exploer

    using the same words to search on ebay for internet explorer, I get results more when I use ebay on FireFox > is cutting some of the results when using Firefox

    It is always possible that eBay is to differentiate between browsers and gives different results, based on previous visits.
    You can try to delete cookies in two browsers to see if it has an impact.

    "Clear the Cache":

    • Firefox/tools > Options > advanced > network > content caching Web: 'clear now '.

    'Delete Cookies' sites causing problems:

    • Firefox/tools > Options > privacy > "Use the custom settings for history" > Cookies: "show the Cookies".
  • Why do I get different results of these

    I use the HR diagram and study the nested instructions. When I run these two SQL statistics I get a different result. Someone knows why?

    Select avg (salary), country_id of
    (select department_id, location_id, salary, country_id of)
    employees join natural services locations of natural join)
    Country_id group;

    Select avg (salary), country_id (select country_id, treatment)
    employees join departments using (department_id)
    Join the locations using (location_id))
    Country_id group;

    Thanks in advance.

    Natural join joins the tables on columns with the same name. If you look at HR. EMPLOYEES and human resources. Tables of DEPARTMENTS, they share two columns department_id and MANAGER_ID while your second query attached just the department_id. If you add MANAGER_ID to the second query that both return the same results:

    SQL> select  avg(salary),
      2          country_id
      3    from  (
      4           select  salary,
      5                   department_id,
      6                   location_id,
      7                   country_id
      8             from  hr.employees natural join hr.departments natural join hr.locations
      9          )
     10  group by country_id;
    
    AVG(SALARY) CO
    ----------- --
           5640 US
           6000 CA
           8500 UK
    
    SQL> select  avg(salary),
      2          country_id
      3    from  (
      4           select  salary,
      5                   country_id
      6             from  hr.employees join hr.departments using(department_id,manager_id)
      7                   join hr.locations using (location_id)
      8          )
      9  group by country_id;
    
    AVG(SALARY) CO
    ----------- --
           5640 US
           6000 CA
           8500 UK
    
    SQL> 
    

    SY.

  • When I concatenate the hexadecimal values of 2 different ways a get different results

    When I concatenate 2 strings in "hexadecimal view" the result is what I want.  When concatenate [a decimal number converted into a hexagon] with [a string in "Display Hex"] the results is very different.  Attached shows the code 2 cases.  In my code, why different 'LDD_Command 2' of 'LDD_Command '?  Thank you.

    The digital conversion to the hex string it gives normal representation (indicator LDD_input) chain. You display in the string with the representation of the hexagon (second part of the command LDD 2), they are not equal.

    If I understood you, you need display data (0CCD is hex for 3277 = u16(1/20*65535). If you need to have data with the representation of string - data should not change, expected just the way which display you them. This is done with the type cast.

  • Why do I get different results for the same resolution but different boxes of Windows, Windows 7 and XP

    I use an .exe on two different windows boxes, in Windows 7 and XP.  I put both for resolution 1024 x 768.

    Win 7 (old laptop and Dell desktop computer) I have a large application to watch.  On the WIn XP boxes all fonts to big.  It doesn't make sense for me as all PC's have the same resolution.

    Has anyone go through this before?

    System for XP and Vista/Win7 fonts are different.

    See

    http://forums.NI.com/T5/LabVIEW/elements-have-moved-when-opening-VI-with-F3-patch/m-p/1054817

    http://forums.NI.com/T5/LabVIEW/what-can-affect-the-size-of-a-front-panel-object-between/m-p/1058607...

    http://forums.NI.com/T5/LabVIEW/font-size-on-Windows-7-with-LabVIEW-2009/m-p/1055114/highlight/true#...

    and several other similar topics.

  • Export PDF get different results if a page or an entire book.

    I have a book from a client who was about 200 pages. It comes to calendars and everyone was in a PDF document and placed in InDesign. They had two AD22 pages at a point and changed the second AD23. It previews AD22 in InDesign, unless the high quality display is chosen, then it previews AD23. When I export the entire book, it exports the calendar AD22. When I export this page only exports the AD23. Also when I print this page it prints correctly. I don't understand what is happening, but thousands of pounds are already printed. If someone else has encountered something like that?

    Try the .idml

  • When you reply to an e-mail, I hit a key on the keyboard and the last part of my email disappeared. How can I get that back? Do you know what button I hit by mistake.

    How to retrieve lines lost in a note of REPLY when I inadvertently hit an unknown key on the keyboard.
    lost lines went all the time.  Has happened to the part of the last paragraph. Is there a magic key?

    Hello Peo/gdo,

    1. what customer e-mail do you use i.e Microsoft Outlook, Windows Live Mail, Hotmail etc?

    2. you have e-mail saved in the drafts folder?

    If you have already sent the email, then there is nothing that me or you can do about it.

    Thank you.

  • Get different search results on different workstations

    Can someone give me some insight on why would be the following:

    Users A and B on two different workstations - both using the same version of the compiled HTML help find their application type the exact same word and click view. At the user obtains a list of 39 subjects and user B Gets a list of 10 subjects.

    I tested it with one of my developers and we have checked that we each entering the same search criteria exact but get different results.

    What should we do to ensure that this happens not when we distribute our application? Or at least what we can do to fix for a user when he arrives?

    I use RH - HTML X5.0.2

    Thank you

    Mark, you're a genius... I am not I never thought to check this.

    Thanks for your help.
    Pat

  • Smart collection returns different results to the library filter?

    This is such a stupid thing, and I barely noticed. I have smart collections simply gather all the images with a particular star of note, very very simple! I have a 1 star, a Star 2 and one for the 3 stars and more. So far so good, use these for centuries-, but I noticed that if I go to Catalog/All photos and place a filter of the same library (this is the filter at the top of the library grid view) I get different results. Actually if I place a filter attribute that says '= 2 stars' images only I can watch the tape that works at the bottom of the screen (sorry I have no idea what it's called) and he said that "all photos / 1056 1647 photos» If I can clear this filter and scroll down to my smart collection that applies the filter even to the entire catalog (and I triple checked this, no difference at all, I don't have lower or higher than the here is the self same "=" only!) and it says "1066"! Thus, the smart collection search 10 images more than other, identical filters working on the entire catalog - I am confused? Anyone had this problem, I missed something? If it wasn't for the number of images concerned I'd them and try to find the additional files by hand!

    Popular indices, and LR3 passing on Mac.

    Tim.

    You can check if the images are stacked differently (and thus not counted) in both points of view.

  • When you try to find the IP address of my computer, I see two different results with two different numbers. Which is accurate?

    original title: a different output for ping - an IP address

    I am trying to determine the name of the computer to an IP address

    When I open a command prompt in a computer (Windows XP connected to our domain) and type ping - a [IP address], I get a result

    When I open a command prompt in another computer (Windows Server 2008 connected to the WORKING group) and type ping - a [IP address], I get a different result

    And there are other times when ping - [IP address] will display the name of the computer on a computer (usually the Windows Server 2008), but not the other

    I tried to google

    1. why this happens

    2. what result is correct

    Please specify.

    The order of DNS in Windows name resolution is as follows:

    1. Name of the local host (file Hosts Local generally in c:\windows\system32\drivers\etc\hosts)
    2. Cache Client DNS resolution
    3. DNS server
    4. Cache of NetBIOS names
    5. WINS server
    6. NetBIOS broadcasts
    7. File LMHosts (same location as the HOSTS file)

    The reason you get different results could be because machines could be on different subnets (different results for broadcast), using a different DNS server machines or are configured for different WINS servers, or the names are already cached because of prior activity.

    HTH,
    JW

  • List of deployed applications. Different results for different hierarchies of MBean

    Hello

    When I list deployed applications, I get different results depending on what hierarchy MBean I question:

    • serverConfig():
    wls:/MY_WEBLOGIC_DOMAIN/serverConfig> listApplications() APPLICATION_1APPLICATION_2
    

    • domainRuntime():
    wls:/MY_WEBLOGIC_DOMAIN/domainRuntime/AppRuntimeStateRuntime/AppRuntimeStateRuntime> ls()
    -r--   ApplicationIds                               java.lang.String[APPLICATION_1, APPLICATION_2, APPLICATION_3]
    

    No idea why is APPLICATION_3 in the list?


    Thanks in advance,

    Luis


    PS: if I apply directly to the managed server:

    wls:/MY_WEBLOGIC_DOMAIN/domainRuntime/ServerRuntimes/prodGAD_1> ls('ApplicationRuntimes')
    dr--   bea_wls9_async_response
    dr--   bea_wls_cluster_internal
    dr--   bea_wls_deployment_internal
    dr--   bea_wls_diagnostics
    dr--   bea_wls_internal
    dr--   APPLICATION_1
    dr--   APPLICATION_2
    

    Hi Vijaya,

    Thanks for your reply, yes you are right, my config.xml file I see this request:

      
        APPLICATION_3
        ...
        ear
        ...ear
        DDOnly
      
    

    But now that I read your response, I already rebooted the AdminServer. This new beginning has resolved the problem.

    Thank you

    Luis

  • Different results of exactly the same query

    Hello

    I wrote a function to calculate the days between 2 dates. If I am running in SQL Developer or directly on the oracle server, I get the results I expected. However, if I run on a client by using ODBC, or PHP connection via the OCI8 extension, I get an incorrect result.

    The function takes 2 parameters: 1st and 2nd date and should output the number of non-working days (weekends and holidays) between 2 dates. The coding is not very pretty, but it does not work very well as I said since the client SQL Developer.

    Here is the code:
    create or replace
    FUNCTION NON_WORKDAYS(fromdate IN DATE, todate IN DATE)
    --Function to calculate non working days between 2 given dates (Weekends & Bank Holidays)
    --Update: Added in a calendar for bank holidays. Bank holidays are listed to the end of 2013
    
    RETURN NUMBER IS
    BANK_HOLS NUMBER;
        ret NUMBER;
    BEGIN
        SELECT count(mydate) INTO ret FROM 
     (SELECT     TO_DATE (fromdate, 'dd-mon-yyyy hh24:mi:ss') + LEVEL - 1 mydate
                    FROM DUAL
               CONNECT BY LEVEL < =
                                TO_DATE (todate, 'dd-mon-yyyy hh24:mi:ss')
                              - TO_DATE (fromdate, 'dd-mon-yyyy hh24:mi:ss')
                              + 1)
         WHERE TO_CHAR (mydate, 'DY') IN ('SAT', 'SUN');
         
         
         select count(mydate) into BANK_HOLS from (
         SELECT     TO_DATE (fromdate, 'dd-mon-yyyy hh24:mi:ss') + LEVEL - 1 mydate
                    FROM DUAL
               CONNECT BY LEVEL < =
                                TO_DATE (todate, 'dd-mon-yyyy hh24:mi:ss')
                              - TO_DATE (fromdate, 'dd-mon-yyyy hh24:mi:ss')
                              + 1
         )
         WHERE TO_CHAR (mydate, 'DD-MM-YYYY') IN 
         ('03-01-2011', 
         '22-04-2011',
         '25-04-2011',
         '29-04-2011',
         '02-05-2011',
         '30-05-2011',
         '29-08-2011',
         '26-12-2011',
         '27-12-2011',
         '02-01-2012',
         '06-04-2012',
         '09-04-2012',
         '07-05-2012',
         '04-06-2012',
         '05-06-2012',
         '12-07-2012',
         '27-08-2012',
         '25-12-2012',
         '26-12-2012',
         '01-01-2013',
         '29-03-2013',
         '01-04-2013',
         '06-05-2013',
         '27-05-2013',
         '12-07-2013',
         '26-08-2013',
         '25-12-2013',
         '26-12-2013'
         );
         ret:= ret + BANK_HOLS;
         
        RETURN ret;
    end;
    The problem is only with certain dates. For example, if I use the date '17-SEP-2012' for the two input parameters, I'm waiting for a result draw. In the SQL Developer client, I get the expected result. However, using ODBC or PHP OCI8 (which I believe is using a direct connection to TNS in the DB), the result returned is '1', which is incorrect ("17-SEP-2012" has been a MONDAY ""). If I use the current date (20-SEP-2012), I get the expected (zero) result in both the SQL Developer client and ODBC/PHP client.

    I also tried to use variants of SYSDATE in place and place the date string, to see if I get different results (i.e. today is 20-SEP-2012, so I used SYSDATE-3 to 17-SEP-2012).

    To be clear, I call the function in a select statement: select (sysdate-3, sysdate-3) non_workdays of the double; or select non_workdays (TO_DATE('17-SEP-2012'), TO_DATE('17-SEP-2012')) of double;

    I have spent hours and hours of troubleshooting this, and it makes me crazy!

    I also checked the view V$ SQLAREA the Oracle DB to see what is actually passed to the ODBC client database engine. I was expecting the statement became corrupted somehow, that's why I get strange results, but this was not the case. The statement in the column SQL_FULLTEXT of V$ SQLAREA, showed exactly the statement I performed on the ODBC Client. I tried with the oracle instantclient and full client (10g).

    Can someone help save my sanity please? I am eternally grateful!

    Sorry for the massive post!

    Published by: user12199535 on 20-Sep-2012 12:20

    Your code is a mess. You convert DATE to DATE, e.g. TO_DATE (fromdate, 'dd-mon-yyyy hh24:mi:ss'). TO_DATE function first parameter is a string, while fromdate is the date. That's why Oracle implicitly converts fromdate to the string of default date format that is client dependent and therefore can produce different results on different customers boxes. In addition, your code is dependent on NLS. If the customer has other date language settings, for example German, Sun and SAT are false. And there is no need to separately calculate the weekends and holidays:

    create or replace
      FUNCTION NON_WORKDAYS(fromdate IN DATE, todate IN DATE)
      --Function to calculate non working days between 2 given dates (Weekends & Bank Holidays)
      --Update: Added in a calendar for bank holidays. Bank holidays are listed to the end of 2013
        RETURN NUMBER
        IS
            BANK_HOLS NUMBER;
            ret NUMBER;
        BEGIN
            SELECT  count(mydate)
              INTO  ret
              FROM  (
                     SELECT  trunc(fromdate) + LEVEL - 1 mydate
                       FROM  DUAL
                       CONNECT BY LEVEL < = trunc(todate) - trunc(fromdate) + 1
                    )
              WHERE TO_CHAR(mydate,'DY','NLS_DATE_LANGUAGE = ENGLISH') IN ('SAT','SUN')
                 OR mydate IN (
                               DATE '2011-01-03',
                               DATE '2011-04-22',
                               DATE '2011-04-25',
                               DATE '2011-04-29',
                               DATE '2011-05-02',
                               DATE '2011-05-30',
                               DATE '2011-08-29',
                               DATE '2011-12-26',
                               DATE '2011-12-27',
                               DATE '2012-01-02',
                               DATE '2012-04-06',
                               DATE '2012-04-09',
                               DATE '2012-05-07',
                               DATE '2012-06-04',
                               DATE '2012-06-05',
                               DATE '2012-07-12',
                               DATE '2012-08-27',
                               DATE '2012-12-25',
                               DATE '2012-12-26',
                               DATE '2013-01-01',
                               DATE '2013-03-29',
                               DATE '2013-04-01',
                               DATE '2013-05-06',
                               DATE '2013-05-27',
                               DATE '2013-07-12',
                               DATE '2013-08-26',
                               DATE '2013-12-25',
                               DATE '2013-12-26'
                              );
            RETURN ret;
    end;
    /
    

    SY.
    P.S. I think that I converted your vacation to literals correctly, but still double check date.

  • Two same queries but different results

    I'm working on the guarantee of data from data sources Vs target.
    Source and target databases are oracle. The source data are a remote database and navigate using DB_LINK.

    I am running similar queries against the data source and my schema but gets different results I check the number of folders and individual service Group DC account
    both are fit exactly, but for some reason any after the results of queries in different counts.

    a request flowing from the source table:
    Select
    b.Year,
    b.month,
    a.serv_grp,
    Count (distinct a.clnt) cnt
    Of
    Jay.srvrequest@bdm_link has,
    (select separate year, month, first_date_of_month, last_date_of_month)
    of dev.stage_3_time_dim
    where year = 2011 and
    b months between 3 and 7)
    where
    a.beg_dt < = b.last_date_of_month
    and a.end_dt > = b.first_date_of_month
    and a.serv_grp in ('1 ', '4', '5',' 6') and
    a.stat as 'A '.
    B.year group, b.month, a.serv_grp;


    target request flowing from the database:


    Select
    b.Year,
    b.month,
    a.service_group_cd,
    Count (distinct a.client_id) cnt
    Of
    Prod.stage_0_mg_serv_req has,
    (select separate year, month, first_date_of_month, last_date_of_month)
    of dev.stage_3_time_dim
    where year = 2011 and
    b months between 3 and 7)
    where
    a.begin_dt < = b.last_date_of_month
    and a.end_dt > = b.first_date_of_month
    and a.service_group_Cd in ('1 ', '4', '5',' 6') and
    a.status_cd as 'A '.
    B.year group, b.month, a.service_group_cd


    results out of data from the source as follows:
    Year month serv grp cnt
    2011 3 1 78653
    2011 3 4 4562
    2011 3 5 166
    2011 3 6 7533
    2011 4 1 78327
    2011 4 4 4540
    2011 4 5 167
    2011 4 6 7546
    2011 5 1 78612
    2011 5 4 4535
    2011 5 5 166
    2011 5 6 7544

    results off-target following data:
    Year month serv grp cnt
    2011 3 1 49350
    2011 3 4 1921
    2011 3 5 26
    2011 3 6 2259
    2011 4 1 47727
    2011 4 4 1834
    2011 4 5 27
    2011 4 6 2211
    2011 5 1 46675
    2011 5 4 1771
    2011 5 5 26
    2011 5 6 2116

    I don't know what wrong with queries
    any advice appreciated...

    Jay

    Maybe you get different results because the data are different.

    Also, why the first query uses a remote table, attached to a local table? Why not 100% remote data?

  • Why do I get 2 different results of these identical derivatives screws?

    I wrote two calculator derived from point by point identical screws and I am at a loss about why

    I get two different results.  I don't know what I have missed/missing which is the origin of this anomaly.

    Please take a look at the downloaded screw (written in LabVIEW 8.0) and let me know what I did wrong.

    Perhaps they are not the same after all.

    Tips for troubleshooting or suggestions are welcome!

    Thank you

    noviceLabVIEWuser

    item 1 of table 1 = 0.9998899980

    item 1 of table 2 = 0.9998900000

    Change the format to display the different values

    the code is identical

  • Why can I get two different results from the same coefficients?

    I get two different results of the evaluation of the polynomial function.

    For the first, I get the coefficients of a polynomial function to adapt.  I feed the coefficients of the function made the function Eval Poly and get the correct 12.8582 result when I evaluate 49940.

    For the second, I create constant array of values that have been returned by the polynomial Fit function (I typed in).  However, I get an incorrect result of - 120.7913 when I feed the constant table the function Eval Poly when I evauate 49940.

    How this can happen when I use the same values in table?

    A picture of what I explained is attached.

    Hi Altran,

    are you sure about using the 'same '?

    You compare them? Do you have (at least) set them to 17 digits display properties?

    Please attach a VI instead of an image...

Maybe you are looking for