Out of the object, it is not what I expected.

I am rewriting a script and I'm having some problems with the release, the partial script is below.

1. something function {}

2 $ESXiVersion = $AllESXiHost | Foreach {Select @{N = 'Version of vSphere';} E={ $_. Name}}, @{N = 'Count'; E={ $_. County}}}
3. $ESXiModel = $AllESXiHost | Model group | Select @{N = 'Server model'; E={ $_. Name}}, County
$ESXiInfo = new-Object - TypeName PSObject
$ESXiInfo | Add-Member - MemberType NoteProperty-name ESXihostCount-value ($AllESXiHost) .count
7. $ESXiInfo | Add-Member - MemberType NoteProperty-name ESXiVersion-value $ESXiVersion
8. $ESXiInfo | Add-Member - MemberType NoteProperty-name 'Model' - value $ESXiModel
Write $ESXiInfo. FL

}

I tried some things, so the line 2 (goes to line 7) is an experience and does not produce anything, but when I write it as line 3 (goes to line 8), I get the same results.

When I call the function, line 2 (line 7 out) and 3 (output line 8) show similar to information

{@{Model server = server;}} Count = 7}, @{model = Proliant Server;} Count = 1}}

I'm guessing that the output is a hash table, but of course I want the "@ {" removed from the script, but I don't know how.  A colleague suggested I use a foreach statement, but I don't know that I did it incorrectly.  If I register, say line 3 as below:

$iHost = get-VMHost | model group | Select @{N = 'Server model'; E={ $_. Name}}, County then the output seems well

I see it's a GroupInfo object... ok, I can go on and on for something simple.  How can I remove the {@{}} my script, so it looks better when released?  Thanks in advance.

HI: DZ1,

Sorry for the confusion between you. Please forget this GetEnumerator, you don't have to use it at all. It was my mistake. I don't know why but I thought that's a hash table and you use getenumerator to split large hashtable of unique items... I don't know what I was thinking then. Ah sorry this one.

Your line

1. $ESXiVersion = $AllESXiHost | Select @{N = 'Version of vSphere'; E={ $_. Name}}, @{N = 'Count'; E={ $_. County}}

is wrong, I guess. If you want to get the esxiVersion you should not query the property 'name '. Name is the name of your host esxi as, esx123.local.biz, but it does she hold the version name. To get esxi version you must use the property named 'version' of the vmhost object.

I don't know what you want to count by this line because:

$AllESXiHost | Select @{N = 'Version of vSphere'; E={ $_. Name}}, @{N = 'Count'; E={ $_. County}}

first of all it will not count anything because you're the count() on vmhost object method that isn't a table or something like that type, which could be counted.

It must be remembered that, in your infrastructure there may be several versions. If you have to do that many heads of charge esxi as many versions as you have in your VC.

This is why I have proposed to put as many version properties as they are.

If this MAIN BIG object for statistics will hold a property for counting version 3, version 4 and version 5 for example. In order to count the individual versions, you have to divide your esxi by these versions boxes

Then

$AllESXiHost | Group-object - property

consolidate all hosts of esxi by their version number, you will receive as many objects as it has versions

You should see something similar to this

Name of County
----- ----
1 3.5.0
2 4.0.0
3 4.1.0

So, we have identified 1 host with version 3.5, 2 guests with version 4 and 3 guests with version 4.1

So everything depends now how you wish to put this information inside your statistics collection of $esxiinfo objects

I have proposed to put 3 different properties, or having 1 House containing an arry.

IF you want to have the simple text, and you do not want to calculate it later anyway, you can just make 1 chain and join these chains in a big 1.

$versions = $AllESXiHost | Group-object - property Version | Select Count, name
$versions

Name of County
----- ----
3 4.0.0
7 3.5.0
6 4.1.0'

I don't know how many versions you will receive. But since you can have mulitple versions I guess you want to distinguish them.

So I thought you want to learn to add as many properties of the versions in the newly created object.

2. $ESXiInfo = New-Object - TypeName PSObject

It's ok

3. $ESXiInfo | Add-Member - MemberType NoteProperty-name of the Version value ($ESXiVersion |) Group - Version) .getEnumerator (of property). Select Count, 'vSphere Version' 0

We will add properties to ESXiInfo now, we will add AS MANY PROPERTIES as NEEDED.

Therefore, add 3 properties

property Version4.0.0,

property Version4.10.0,

Version3.5.0 property

So instead of the line that we should use

$versionss | % {Add-Member - InputObject $ESXiInfo - MemberType NoteProperty-Name "Version$ ($_.)"} Name)"- value of $_. County}

For each version, that we found, we will add new Member to our object of $ESXiInfo. This command will automatically add as many versions they are.

Your ESXiInfo object will now have new properties

# 23:01:55 > $ESXiInfo | GM

TypeName: System.Management.Automation.PSCustomObject

Name MemberType definition
----         ----------   ----------
Equals method Boolean Equals (System.Object, obj)
GetHashCode method int GetHashCode()
Type of the method GetType GetType()
String the ToString ToString() method
Version3.5.0 NoteProperty System.Int32 Version3.5.0 = 7
Version4.0.0 NoteProperty System.Int32 Version4.0.0 = 3
Version4.1.0 NoteProperty System.Int32 Version4.1.0 = 2

So you can get

# 23:02:55 > $ESXiInfo. 'Version3.5.0 '.
7

I think that I have explained your 3 lines.

Now if you really want to have an additional property only 1 for versions, you can do it like that.

line 1

$AllESXiHost | Group-object - property Version | select count, name | % {[table] $versionss2 += 'Version $($_.)} (Name) = $($_.) County)"}

This line will create the variable $versionss2, which will be used to maintain information about the versions of esxi.

Lets first get the versions and their count but store this information in a simple table.

I # 23:05:20 > $versionss2
Version 4.0.0 = 3
Version 3.5.0 = 7
Version 4.1.0 = 2

OK, we have 3 rows in our table, but you want to have only 1 property for versions so join us just these lines.

So we call add-member only ONCE, this time:

Add-Member - InputObject $ESXiInfo - MemberType NoteProperty-Name 'Esxi Versions' - value [string]: join(',',$versionss2)

We are joinng all loose our table with versions with comma.

Take a look how your object will now look like:

# 23:10:55 > $ESXiInfo | FT - AutoSize

Version4.0.0 Version3.5.0 Version4.1.0 Esxi versions
------------ ------------ ------------ -------------
3 7 122 version 4.0.0 = 3, Version 3.5.0 = 7, Version 4.1.0 = 2

first 3 columns were the first method, fourth colum is the new approach. So if we would not include even the former approach, it would look like this

ESXi versions
-------------
Version 4.0.0 = 3, Version 3.5.0 = 7, Version 4.1.0 = 2

And for the model, you do exactly the same thing, but instead measure the version property, you need to measure the model.

I hope that is more clear.

Greg

Tags: VMware

Similar Questions

  • Well this version allows to update your browser all the minutes as would be the former, and if not what version will leave you well do this?

    Well this version allows to update your browser all the minutes as would be the former, and if not what version will leave you well do this?

    This?

  • When I click on the menu option 'Open Site' he does not what to expect, is rather shows the desktop on my iMac.

    When I click on the menu option 'Open Site' he does not what to expect, is rather shows the desktop on my iMac.

    What you see is exactly the way it should work. Open the site your Finder window opens, so you can access the .muse file you want to open. Recently opened (just below it) will show the list of sites you have worked on lately. I don't know what else await you.

    I should probably see a list of site temp I want to open or DELETE?

    No, Muse or any other program besides will not open a file that you do not select to open. To remove a site simply open Finder on Mac go to the location of the file and delete it in one of the many ways that a Mac allows you to do.

  • iTunes update errors with the following message appears: there is a problem with this Windows Installer package. A program run as part of the set up did not complete as expected.

    iTunes error update

    I am trying to install an update to iTunes on my laptop and find the folowing part-way through the installation error:

    "There is a problem with this Windows Installer package. A program run as part of the set up did not complete as expected. Contact your provider to support personal or package. »

    I got iTunes for 3-4 years now and have always been able to install updates successfully, so don't not sure what is the problem.

    I tried msconfig and changed the boot process, so it includes all of the non-Windows elements, as suggested on the Microsoft Web site, but that has not worked.

    Can anyone help?

    Thank you

    The instructions were to contact the vendor of the package. This isn't iTunes, Microsoft.

    Ask the question in the Apple Forums:
    https://discussions.Apple.com/index.jspa

  • Question of Safari and Chrome. indicates on the navigation screen. "An element of the Protection of the family filter does not work as expected. Restart your computer. If the problem persists, contact support.  Error: failed to hose CPI. »

    Question of Safari and Chrome. indicates on the navigation screen. "An element of the Protection of the family filter does not work as expected. Restart your computer. If the problem persists, contact support.  Error: failed to hose CPI. »

    Quit Safari, Chrome to quit smoking. If necessary Forcequit.

    Start Safari while holding the SHIFT key, select the menu Safari ClearHistory, then after this check that the homepage is the one you want.

    Do the same for Chrome.

    Close all browsers, restart the mac.

  • Windows Installer error there is a problem with this windows package install. a program run as part of the set up did not complete as expected "during the installation of Itunes

    Original title: problem WIndows Installer to install the latest version of i tunes

    When I try to install the latest I tunes version 10, I get a message "there is a problem with this windows package installer. a program run as part of the set up did not complete as expected "the downloads version, but will not be installed."  How can I fix?  I have an earlier version, but I need to update to use my i pad.

    Hello

    You can try the steps of troubleshooting provided in the link below and check if the problem persists.

    Problem installing iTunes or QuickTime for Windows

    http://support.Apple.com/kb/HT1926

    To get help on the issue, you can get in touch with support for ITunes.

    http://www.Apple.com/support/iTunes/

  • All the editing options appear disabled when you compose the message, impossible to copy & paste, etc they are grayed out in the menu and do not work in a mouse right click

    Change options - Undo, redo, copy, paste, paste without formatting work, is that they are shaded out in the Edit menu and do not work on the right click of the mouse. I disabled add ons, run in safe mode, go out and restarted but the problem persists. Can anyone help urgent please.

    Mine are greyed out until they can do something. So they're all gray until I have started typing, pasting is grayed if there is nothing on the Clipboard and copy / cut are gray until I have select something.

    Yours are always grey, even after doing these other things?

  • While trying to access another document, I get this "error in the object calling ScriptTypeError not valid."

    Original title: error

    I work in the database search.  In a particular site while trying to access another document, I get this... Error in the object of the invalid ScriptTypeError call.

    How can I fix it?  I be milling of the answers, I went to frequently asked questions, found no answers. I hope someone can help.

    Thank you

    pipster43

    Hi Pipster43,

    Your question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for Windows Server on TechNet forum. Please ask your question in the Forums in TechNet Windows Server.

  • HP Pavillion DV5020 that blanks out when the power cord is not plugged in.

    I have a HP Pavillion DV5020 that white outside when the power cord is not plugged in.  Then, when it is in it's very well and when he's not even starts not with the screen committed.  It is NOT the function sreensaver.  Can I plug an external monitor and see what happens, but the maternal lines white leaves display off whenever it is on battery power.

    Anyone seen this before?

    g

    I would recommend to go ahead and reset the computer of hard edge. This is one of the best steps for these types of troubleshooting questions. Here is a link that will guide you through the steps on how to perform a hard reset: http://goo.gl/6mk6K

    I would like to know how it works and post back with all new details.

    Thank you!
    Sean

  • States of the objects Panel does not work in CS6, please help!

    I have InDesign installed CS6 (same license) on my work computer and home computer. The object States Panel works very well at home. At work, the Panel upwards, but it is always empty, even though I have a selected object that has an applied state.

    I think that I have to uninstall/reinstall and I hope that it will work again.

    On a side note, when I save the file down to of CS5, CS6 and open in CS5, the States of the object is now visible. I have attached a picture. Top two images are screen grabs of the file open in CS6. The two photos below are same file open in CS5. See how the States of the objects are visible in CS5 and CS6 not.

    CS6ObjectStatesnotworking.jpg

    Thjnis kind of problem is usually fixed by trashing the prefs see replace your preferences

  • Update is not what I expect.

    Hello!

    UPDATE yhhapu:
    SET h.ashu_kala =
    (By SELECTING b.grossarea IN bubuilding b
    WHERE h.id = b.id AND h.ashu_kala > b.grossarea);

    I was wondering why this update changes all the data ashu_kala to null. This is not what I'm trying to do.
    It seems to update all rows to null. But it suppose to be the values of grossarea.

    What should I do about it!

    Thank you! OV

    You did not specify a WHERE clause, which would limit the number of rows updated.

    Some examples of UPDATES with a WHERE clause:

    http://download.Oracle.com/docs/CD/E11882_01/server.112/e10592/statements_10008.htm#i2189756

  • Stick to the original Position does not work as expected

    Experiencing a bug "Stick to the initial Position": the copied sequence is stuck slightly forward with regard to the point of law

    What are the LPX and OS X versions?

  • Fill in the page for the site test under design Web does not appear in firefox. I have to zoom out to the page to appear. What is the problem?

    Hello

    I am designing a Web test page and it looks wrong in firefox... half top of page Web appears and I have to press ctrl and - to see the whole page... also, even when I see the entire page, the right scroll bar that appears on every Web page does not appear? What could be the problem? Any help will be appreciated.

    The missing scroll bar is caused by the position: fixed; and top: 0px; rules.

    DIV .header also has a height: 100px which is not correct.

    .header {
    background-image: url(images/bg-header.jpg);
    padding: 0px 0px 0px 0px;
    height: 100px;
    position: fixed;
    top: 0px;
    width: 100%;
    z-index: 50;}

    A good place to ask for advice on web development is to the 'Web Standards Development/evangelism' MozillaZine forum.

    Aid to this forum are better informed on issues related to web development.

    You must register on MozillaZine forum site to post in this forum.

  • RUN the object that will not start Windows on-screen keyboard

    I use Lookout 6.5 on Windows 7 Professional. I use a button to fire a sequencer whose output starts a RUN object with a command line of the 'c:\Windows\system32\osk.exe '. Executes the RUN object, but I get a window that says "could not start on-screen keyboard. The window has only 'OK' as an option - click on OK and the window disappears. I tried the same object RUN notepad.exe with wordpad.exe, and they work very well.

    Anyone see what I'm missing?

    Thanks for your reply, Ryan.

    I have now found a solution – but first a few puzzles. I can use the Lookout RUN object successfully to start other executable files in the Windows\system32 folder - but not the osk. I can start the osk in other ways (shortcut, double-clicking the .exe from a .bat file).

    I copied the osk.exe to another folder on the hard drive and can now begin with the Lookout RUN object. I don't know why this works differently - but it does. Thank you.

  • category of recordset to filter the slot category does not, what am I doing wrong

    I've done this lots of times, but must have made a mistake, because I can't make it work

    I have a list of category show all categories

    ymysql_select_db ($database_lotties, $lotties);

    $query_rsProductData = "SELECT * FROM lottieCat ORDER BY lottieCat.CatName";

    $rsProductData = mysql_query ($query_rsProductData, $lotties) or die (mysql_error ());

    $row_rsProductData = mysql_fetch_assoc ($rsProductData);

    $totalRows_rsProductData = mysql_num_rows ($rsProductData);

    ? >

    <? PHP {? >}

    < a href = "subCat - list.php?" subCat = <? PHP echo $row_rsProductData ['subCatID'];? > "> <?" PHP echo $row_rsProductData ["productGroupGUID'];? > < br / >

    < /a >

    <? PHP} while ($row_rsProductData = mysql_fetch_assoc ($rsProductData));? >

    <? PHP

    mysql_free_result ($rsProductData);

    ? >

    but the link I want to send the page, but it does not work to the subcategory. Here's the sql code of the category sup page

    $varCat_rsProductData = '0 '.

    If (isset($_GET["subCat"])) {}

    $varCat_rsProductData = $_GET ['subCat'];

    }

    @mysql_select_db ($database_lotties, $lotties);

    $query_rsProductData = sprintf ("" SELECT * FROM LOTTIE_subCats, lottieCat WHERE lottieCat.CatID = LOTTIE_subCats.CatID AND lottieCat.CatID = %s ", GetSQLValueString ($varCat_rsProductData,"int")");

    $query_limit_rsProductData = sprintf ("%s LIMIT %d, %d", $query_rsProductData, $startRow_rsProductData, $maxRows_rsProductData);

    $rsProductData = mysql_query ($query_limit_rsProductData, $lotties) or die (mysql_error ());

    $row_rsProductData = mysql_fetch_assoc ($rsProductData);

    joins in the table are

    table = lottieCat

    CatID

    CatName

    table = LOTTIE_subCats

    subCatID

    CatID

    then the product is

    table = LOTTIE_products

    subCatID

    what I am doing wrong

    OK, so if you want to produce a list of subcategories, you do not need to join to the table of categories.

    $query_rsProductData = "SELECT * LOTTIE_subCats WHERE LOTTIE_subCats.CatID = %s;

Maybe you are looking for

  • My locked Apple Watch E-mail of the first owner

    I have Apple Watch of my friends, but he forgat to unlocked the Apple Watch, so it uses only apple not more. And now I can't have my iphone at Apple Watch matching. How to solve this problem? Anyone has the same problem with me?  Thank you

  • print spooler stopped

    Shutdown abnormally and now take print spooler stop.  I restart the spooler, but it stops again.  How can I fix it?  I should point out that I tried to uninstalled/reinstalled the HP printer, what has not worked.  I also tried to use Microsoft FIX it

  • WRT1900AC - password is admin?

    Well, not sure if this happened to someone else. I had problems with the router, chatted with technical support, did what they suggest: 1.Re - flash the new firmware 2. Hold button reset for 10 seconds. I was somewhere, a few new options for options

  • Merger of photo files

    We have just returned from a tour of New England.  After each day, I downloaded photos/videos from my SD card on my laptop.  Thinking that I have entitled all downloads the same, however, on one of these days that there is a slight difference.  Now w

  • How can I search for and delete all files transferred to double

    I have double the files transferred from another computer, as well as data in my phone WM6.5 double and photos from my camera in double. I am on Windows 7 and looking for a way to compile, sort out the duplicate a lot of files, I created over time, b