Power cli script does not work for multiple VM

Hello

Please find the script to get the cpu usage and the memory of the virtual machine.

Attached script works fine for single virtual machine. We get the output so that a virtual machine, there are still several vm in the source file. Output file is also attached.

I don't know there are more elegant ways to do this, but it should work for you.

$metrics = "cpu.usage.average", "mem.usage.average".

$start = (get-Date). AddDays(-1)

$vmList = get-Content - Path C:\_temp\VMs.txt

$MyCol = @)

$Results = @)

foreach ($vm to $vmList)

{

Get-Stat - $vm - Stat $metrics entity - start $start |

Group-object - property entity.

ForEach-Object-Process {}

$MyCol = "| Select-Object - property VM, Date, CPU, memory

$MyCol.VM = $_. Group [0]. @entity.name

$MyCol.Date = $_. Group [0]. Timestamp.Date

$MyCol.CPU = $_. Group |

Where-Object - FilterScript {}

$_. MetricId - eq $metrics [0]

} |

Measure-object-medium - value of the property.

Select-Object - ExpandProperty average

$MyCol.Memory = $_. Group |

Where-Object - FilterScript {}

$_. MetricId - eq $metrics [1]

} |

Measure-object-medium - value of the property.

Select-Object - ExpandProperty average

}

$Results += $MyCol

}

$Results | Export-Csv-path C:\_temp\vm-resource-report.csv - NoTypeInformation - UseCulture

Tags: VMware

Similar Questions

  • Firefox does not work for multiple instances of the SAME user account on Windows Multipoint Server 2011

    We have a PC HP of MulitSeat MS6200
    It runs Microsoft Windows MultiPoint Server 2011 (which seems to be a twisted version of Windows 7)
    It is implemented in a laboratory of computer science and students connect you using their account for shared room - IE multiple instances of the same user accounts are currently running on the PC at the same time.
    The first student to run Firefox can work with it without a problem.
    However, when another student try to start firefox they get the following message:
    Firefox is already running but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system.

    Cannot start Firefox using a profile that is already used by someone else.
    Each Firefox instance needs its own profile or you will get this error message.

    Use-no.-line switch remote control to open another instance of Firefox with its own profile and to different instances of Firefox running concurrently.

  • Tiara startup script does not work when running file associated with

    Hello

    I have a startup script that works correctly with tiara itself, however when I open a file associated with tiara (tdms files) the startup script does not work.  Is it possible to ensure that the script runs without worrying?  Thanks for the help!

    Bala

    Hi Bala,

    Depending on your use case, I suggest you call the next VI, which comes with LabVIEW, after your purchase VI is the creation of the data file.  Just pass the data file path in the upper part of entry and your path to the VBScript file in less than entry.

    "C:\Program Files (x 86) \National Instruments\LabVIEW 2013\vi.lib\ExportToExcel\DIAdem report Assistant Start CSC.vi '.

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • Describe in SQL script does not work as you wish

    Hello

    Could you please help me determine why this script does not work.
    He said that the date is not set.

    Thanks in advance


    set p_day_sh = & data_sh
    set p_rowid_sh = & rowid_sh
    declare
    date of p_day_sh;
    p_rowid_sh varchar2 (18);
    Start

    If & p_day_sh is not null then
    trains t update
    Set t.offdate = to_date ('& p_day_sh ',' DD-MM-YYYY HH24:MI:SS')
    where t.rowid = '& p_rowid_sh';
    commit;
    end if;
    end;

    Hello

    In a command SET, if the string to the right of the = sign contains spaces, then it must be in quotes: in the case otherwise, only the first group of characters, white space will be affected.
    For example:

    define p_day_sh = &data_sh
    

    If & data_sh has this value:

    11-06-2009 06:25:09
    

    then the DEFINE command is

    define p_day_sh = 11-06-2009 06:25:09
    

    and & p_day_sh Gets the value of the part to the workspace:

    11-06-2009
    

    Either eliminate the space, Alex has proposed, or place the chain on the right side of the sign = in double - quote:

    define p_day_sh = "&data_sh"
    

    The double quotes will not change the meaning if & data_sh contains no white space.

  • Single-pass does not work for Web sites after the last update of firefox

    Single-pass does not work for Web sites after the last update of firefox. This works in IE and Chrome and it works under windows (when starting the computer), but not with any website in Firefox.

    Firefox 30 spent some less commonly used "Always turned on" plugins "asking to activate. To check and change this to SimplePass, you can use the page modules. Either:

    • CTRL + SHIFT + a
    • "3-bar" menu button (or tools) > Add-ons

    In the left column, click on Plugins. Then on the right, check the control on the right side of the SimplePass.

    You may need to exit Firefox and start it again before it takes effect.

    A little luck?

  • Firefox Sync does not work for Tablet Android Nexus 10.

    Firefox Sync works for 2 PCs, but does not work for an Android tablet. It is said, that the tablet was connected successfully, I checked the bookmarks and history options to be synchronized and or bookmarks, or history of the browser has not been updated on my tablet.
    No errors. Anything not came to the Android device.
    I tried with 2 different synchronization profiles - same story for the second profile.

    Please note that we are currently living with Sync server issues. Our technicians are working around the clock to the question of setting and ensure that it works at its best. The current option is to try to keep synchronized and if you are able to synchronize properly, we recommend to not not to sync more than once every 2 hours.

    Thank you and sorry for the inconvenience.

  • Recently closed tabs does not work for me

    Recently closed tabs does not work for me. When I go to history-> recently closed tabs is not available and the shortcut does not work. It happened a few weeks ago, and when it happened first, the shortcut would open the tabs in the weeks earlier. I can't find any information on this and would like to see it fixed.

    There are other things that need your attention on the updated the prefs that shows in your list of details of the system.

    Reset the general.useragent.compatMode.firefox to false, and all prefs network.http on the topic: config page.

    What is the value of the browser.sessionstore.max_tabs_undo pref?

  • iMessage does not work for me. I have no text to send or receive texts as an alternative. I am able to use the Internet to navigate / social media but iMessage completely ceased to operate. I tried the usual phone turn off / on, reboot, etc.

    iMessage does not work for me. I have no text to send or receive texts as an alternative. I am able to use the Internet to navigate / social media but iMessage completely ceased to operate. I tried the usual phone turn off / on, reboot, etc. and still nothing. What can I do?

    What methods have tired to get it activated?

    You can disconnect from the iMessage

    Disconnect from the iCloud

    Reboot your phone

    Reconnect

    Wait iMessage activate

    Do you have a viable data plan?

  • AutoFill does not work for Firefox 4 and Microsoft Outlook

    AutoFill has already worked on Firefox 3.16 and Microsoft Outlook.
    Now I get a msg something like:
    "AutoFill does not work for this site" when I want to fill my info on a petition, etc..

    What "complete" you use in Firefox 4.0?

    Firefox is not a built-in function "fill", it has "full automatic" that would not display a message such as.

  • I keep seeing pop up ads powered by '' cn tatami '' whenever I have to navigate using Safari or open a link on the FB Adblocker app does not work for this. Any suggestions? There is no option to cross the pop-up ad that it redirects to various Web sites.

    I keep seeing pop up ads powered by '' cn tatami '' whenever I have to navigate using Safari or open a link on the FB Adblocker app does not work for this. Any suggestions? There is no option to cross the pop-up ad that it redirects to various Web sites.

    Cache and history of the site Clear settings - Safari -.

    (1232)

  • I need a program to view usable photograph or app to open my pictures to view them, open them in my editing software. Apple makes such a program? Photo does not work for me.

    I have a 27 "iMac, I photograph and videos. The Photos app does not work for me. I would like to have a program that will open my photography let me scroll through the folder of photos and when I find one that I need to change in my photoshop cs6 software I can open the file, then save in my pictures folder.  I am now watching the Mac Book Pro. 15 "the $2499 but I need a usable photo view software. I'm not the editor, import, the shared project, etc., I want only the Viewer.  I have purchase different applications that does not work. The last was the date limits only one that I could find I want but it not work altogether after about 4 days. The name of it is (Viewer). I really want to get another Mac product because I like really everything except the viewer or no photo viewer. Please help, it is very important for me!

    Diana_G100

    If you simply want to watch as download you them from your camera, you can simply use the default built in app Preview. He opens them - that is what I use before deciding that one has need of some 'creative' changes or anything, and then drop them into my own folder of Photos (in my documents) that I created when I decided that I did not care to iPhoto or Photos.

  • Satellite L20-100 Touch Pad scroll does not work for Mozilla Firefox

    Hello

    Mine is a laptop Satellite L20-100. My touch pad scroll (the page scrolls automatically when you slide your finger upwards & downwards on the right edge of the touch pad) does not work for the Mozilla Firefox browser. It works fine with other applications like windows Explorer, microsoft word. When I try to scroll in the window of the Firefox browser, this isn't schroll at all. Please can someone help me?.

    Kind regards
    Anish

    Hello

    Read on the forum of Firefox:

    http://forums.mozillazine.org/viewtopic.php?t=221466

    If it doesn't help you, after your problem here

    Post edited by: Jeka -?

  • The button create a new paragraph style does not work for me, is this a bug or something stupid I did?

    The button create a new paragraph style does not work for me, is this a bug or something stupid I did?

    Pages on El Capitan 10.11.1 v5.6.1.

    I just created a quote indented using ITC Garamond Book Italic with left and right margins altered. Well selected, I clicked on the + symbol in the paragraph, named the new Styles pop-up style Indented quote and you press return.

    Always selected in the body of the document, I applied the body paragraph Style to restore the normal formatting and then with the text again, the paragraph of citation Style indented - who worked as expected.

    If you want that your new Style of paragraph to survive across documents, you will need to save it in a model. You can also have two different Pages, documents open in Pages v5.6.1, and copy/paste the custom styles between the selected text in these documents by using the Format menu.

  • M1271mfw charger of HP printer does not work for scanner

    The charger works for making copies, but it does not work for the scanner.

    Re: M1271mfw HP printer charger does not work for scanner

  • I had a windows 2008 r2 domain 1 DC everything worked fine, I added a second windows of DC 2012 now Kerberos does not work for RDP

    I had a windows 2008 r2 domain 1 DC everything worked fine, I added a second windows of DC 2012 now Kerberos does not work for the RDP, Hyper V replication is nothing below a couple of samples of what I see I do not know where to begin finding the problem

    + System

    -Supplier

    [Name]  Microsoft-Windows-Security-Kerberos
    [Guid]  {98E6CFCB-EE0A-41E0-A57B-622D4E1B30B1}
    [EventSourceName]  Kerberos
     
    -EventID 3

    [Qualification] 32768
     
    Version 0
     
    Level 2
     
    Task 0
     
    Opcode 0
     
    Keywords 0 x 80000000000000
     
    -TimeCreated

    [SystemTime] 2016-01 - 03 T 01: 34:27.000000000Z
     
    2991 EventRecordID
     
    Correlation
     
    -Execution

    [ProcessID] 0
    [ThreadID] 0
     
    Channel system
     
    Computer DC02.xxxxxxonline.com
     
    Security

    -EventData

    LogonSession xxxxxxONLINE.COM\xxxxxx
    ClientTime
    1:34:27.0000 03/01/2016 Z ServerTime
    Error code 0 x 19
    ErrorMessage KDC_ERR_PREAUTH_REQUIRED
    ExtendedError
    ClientRealm
    CustomerName
    ServerRealm xxxxxxONLINE.COM
    ServerName krbtgt/xxxxxxONLINE.COM
    TargetName krbtgt / * address email is removed from the privacy *
    ErrorText
    E file
    Line d3f
    30773054A103020113A24D044B3049301FA003020112A1181B16524F434B45594F4E4C494E452E434F4D726F636B65793005A003020117301FA003020103A1181B16524F434B45594F4E4C494E452E434F4D726F636B65793009A103020102A20204003009A103020110A20204003009A10302010FA2020400

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

    Binary data:

    In the words

    0000: 54307730 010203A 1 044DA213 3049304B
    0008: 0203A01F 18A 11201 4F52161B 59454B 43
    0010: 494C4E4F 432E454E 6F724D4F 79656B 63
    0018: 03A 00530 30170102 0203A01F 18A 10301
    0020: 4F52161B 59454B 43 494C4E4F 432E454E
    0028: 6F724D4F 79656B 63 03 HAS 10930 A2020102
    0030: 30000402 0203 HAS 109 02A 21001 09300004
    0038: 010203 A 1 0402A20F 00

    In bytes

    0000: 30 77 30 54 A1 03 02 01 0w0T¡...
    0008: 13 4 04 4 B 30 49 30 A2. ¢ M.K0I0
    0010: A0 03 02 01 12 A1 18 1F. ....¡.
    0018: 1 16 52 4F 43 4 B 45 59 B... XXXXXX
    0020: 4F 4 49 4F 4E 45 2ND 43 ONLINE. C
    0028: 4 72 6F 63 6 b 65 79 OMxxxxxx 4F
    0030:30 05 A0 03 02 01 17 30 0. .... 0
    0038: A0 03 02 01 03 A1 18 1F. ....¡.
    0040: 1 16 52 4F 43 4 B 45 59 B... XXXXXX
    0048: 4F 4 49 4F 4E 45 2ND 43 ONLINE. C
    0050: 4 72 6F 63 6 b 65 79 OMxxxxxx 4F
    0058:30 09 03 02 01 02 A2 A1 0... ¡¢
    0060: 02 04 09 03 02 A1 00 30... 0.¡..
    0068:01 A2 02 04 00 30 09 10... ¢... 0.
    0070: A1 03 02 01 0F A2 02 04... ¢...
    0078: 00                        .

    + System

    -Supplier

    [Name]  Microsoft-Windows-Security-Kerberos
    [Guid]  {98E6CFCB-EE0A-41E0-A57B-622D4E1B30B1}
    [EventSourceName]  Kerberos
     
    -EventID 3

    [Qualification] 32768
     
    Version 0
     
    Level 2
     
    Task 0
     
    Opcode 0
     
    Keywords 0 x 80000000000000
     
    -TimeCreated

    [SystemTime] 2016-01 - 02 T 16: 52:38.000000000Z
     
    2943 EventRecordID
     
    Correlation
     
    -Execution

    [ProcessID] 0
    [ThreadID] 0
     
    Channel system
     
    Computer DC02.xxxxxxonline.com
     
    Security

    -EventData

    LogonSession xxxxxxONLINE.COM\xxxxxx
    ClientTime
    16:52:38.0000 02/01/2016 Z ServerTime


    Error code 0 x 19
    ErrorMessage KDC_ERR_PREAUTH_REQUIRED
    ExtendedError
    ClientRealm
    CustomerName
    ServerRealm xxxxxxONLINE.COM
    ServerName krbtgt/xxxxxxONLINE.COM
    TargetName krbtgt / * address email is removed from the privacy *
    ErrorText
    E file
    Line d3f
    30773054A103020113A24D044B3049301FA003020112A1181B16524F434B45594F4E4C494E452E434F4D726F636B65793005A003020117301FA003020103A1181B16524F434B45594F4E4C494E452E434F4D726F636B65793009A103020102A20204003009A103020110A20204003009A10302010FA2020400

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

    Binary data:

    In the words

    0000: 54307730 010203A 1 044DA213 3049304B
    0008: 0203A01F 18A 11201 4F52161B 59454B 43
    0010: 494C4E4F 432E454E 6F724D4F 79656B 63
    0018: 03A 00530 30170102 0203A01F 18A 10301
    0020: 4F52161B 59454B 43 494C4E4F 432E454E
    0028: 6F724D4F 79656B 63 03 HAS 10930 A2020102
    0030: 30000402 0203 HAS 109 02A 21001 09300004
    0038: 010203 A 1 0402A20F 00

    In bytes

    0000: 30 77 30 54 A1 03 02 01 0w0T¡...
    0008: 13 4 04 4 B 30 49 30 A2. ¢ M.K0I0
    0010: A0 03 02 01 12 A1 18 1F. ....¡.
    0018: 1 16 52 4F 43 4 B 45 59 B... XXXXXX
    0020: 4F 4 49 4F 4E 45 2ND 43 ONLINE. C
    0028: 4 72 6F 63 6 b 65 79 OMxxxxxx 4F
    0030:30 05 A0 03 02 01 17 30 0. .... 0
    0038: A0 03 02 01 03 A1 18 1F. ....¡.
    0040: 1 16 52 4F 43 4 B 45 59 B... XXXXXX
    0048: 4F 4 49 4F 4E 45 2ND 43 ONLINE. C
    0050: 4 72 6F 63 6 b 65 79 OMxxxxxx 4F
    0058:30 09 03 02 01 02 A2 A1 0... ¡¢
    0060: 02 04 09 03 02 A1 00 30... 0.¡..
    0068:01 A2 02 04 00 30 09 10... ¢... 0.
    0070: A1 03 02 01 0F A2 02 04... ¢...
    0078: 00                        .

    This issue is beyond the scope of this site which is for the consumer to related issues.

    To ensure that you get a proper answer, ask either on the Technet site, if it is a type of Pro problem, or MSDN if it's related to the developer

    http://social.technet.Microsoft.com/forums/en-us/homes/en-us/home

    http://social.msdn.Microsoft.com/Forum

Maybe you are looking for

  • publish photos on Facebook

    When I post a picture on Facebook, it seems that my partner has posted?

  • Possible scam invoices

    I got 2 of the same invoice with a [email protected] invoice numbers, I didn't buy the music, so I think it's a scam. Can anyone confirm this?

  • MacBook or Air Mabcbook

    Hi all.. I wonder which of these two decide to do: -. 12' new Macbook or MacBook Air 13' Since I am already coming from a 'pro' I think the MBA 11' would be too small, that's why I stay with 13 or possible 12-programming Any show apart from the diffe

  • cannot turn off Plugin Check

    For some reason any Firefox suddenly started to open a the automatic plugin update every time that I open the browser, and I don't see how to disable this annoying feature. Most of the plugins come only as 'research '.

  • Can not run the demo of StarCraft or downloaded files

    It is not just drop the files basically downloaded everything as downloaded demos... I can't run the DEMO of StarCraft for example, even on here, if I download it. I must have a CD or a DVD-ROM... Its very annoying... Basically, I can't run everythin