Get-VIEvent - how to export the event type?  error, warning, or info

Hello

I know that the Get-VIEvent command allows you to specify the type of events to get back... that is to say [-Types < EventCategory [>]

but, I want to extract all the events and export them to a CSV file. I want one of the columns to be "EventCategory", which will be ERROR, WARNING, or INFO, but I can't seem to find it.  $_. GetType(). Name gets me the type of event, but not the category.  I know that I can have my script executed 3 times (each time specifying the - parameter Types) but I want to run only once.  Any ideas?

Thank you!

Jeff

Hello, horningj-

I worked on a few elements that should attract the event category.  The first selects a few properties, including a calculated property that gets the event category:

## works well if no events of type 'EventEx'## get the .Net View object of the EventManager (used for getting the event Category) $viewEventMgr = Get-View EventManager ## get some VIEvents, select a few properties, including a calculated property for EventCategory Get-VIEvent | Select FullFormattedMessage, CreatedTime, @{n="EventCategory"; e={$strThisEventType = $_.GetType().Name; ($viewEventMgr.Description.EventInfo | ?{$_.Key -eq $strThisEventType}).Category}}

It becomes VIEvents (the last 100, because I did not specify the parameter - MaxSamples) and returns the properties of data.  The calculated "EventCategory" property uses the type of the VIEvent object to search for in the collection of items EventDescriptionEventDetail in ownership eventInfo found in .net object View for the EventManager.  He then grabs the 'Category' of the corresponding element of EventDescriptionEventDetail property.

Works fine unless you have any VIEvents type "EventEx" - then, this 'research' in EventDescriptionEventDetail collection method fails, because there is more than one element of this type (there are 91 of them at the moment).

This led me to the next bit.  It is similar to the previous method, but it handles EventEx events too:

## get the .Net View object of the EventManager (used for getting the event Category)$viewEventMgr = Get-View EventManager

## get some VIEvents (the last 100, as "-MaxSamples" is not specified) Get-VIEvent | %{    ## put the pipeline varible into another variable; get its type    $oThisEvent = $_; $strThisEventType = $_.GetType().Name    ## if this event is of type "EventEx"    if ($strThisEventType -eq "EventEx") {        $strEventTypeId = $oThisEvent.EventTypeId;        ## get the EventInfo item (of type EventDescriptionEventDetail) whose "FullFormat" property begins with the EventTypeId of the VIEvent at hand, and get its "Category" property        $strCategory = ($viewEventMgr.Description.EventInfo | ?{$strRegexPattern = "^$strEventTypeId\|.*"; $_.FullFormat -match $strRegexPattern}).Category    } ## end if     ## else, can just grab the EventInfo item whose "Key" is the same as this event's type    else {$strCategory = ($viewEventMgr.Description.EventInfo | ?{$_.Key -eq $strThisEventType}).Category}    ## add a NoteProperty "EventCategory" to this event    $oThisEvent | Add-Member -MemberType NoteProperty -Name EventCategory -Value $strCategory -PassThru} | Select FullFormattedMessage, CreatedTime, EventCategory

It seems that the EventTypeId of the event returned by Get-VIEvent is included in the first part of the property FullFormat of elements EventDescriptionEventDetail with EventEx key, separate from the rest of the value by a vertical pipe.  Thus, the EventTypeId of the VIEvents can be used to make a match on EventEx of events .net EventManager View object types to get the event 'category' (info, warning, error, user).

You can, of course, change the Select statements to choice/choose the pieces of information you want to export and then export to a file of data as you please.

How does do for you?

* The message has been edited by mattboren on April 5, 2011 - added line at the beginning of the second piece of code '$viewEventMgr = Get-view event Manager.  It was already in the first room and assumes that the user has run the two parts in the same session, but added for completeness.

Tags: VMware

Similar Questions

  • How to check the event.target type in the "if" statement

    Hi, I have "roll-over" event listener and I wish that only works with music videos (without textfields etc.). I would write something like this:

    if(Event.Target == MovieClip) {do something}

    else {do something}

    This does not work properly.

    How to check the event.target type in the "if"?

    Thanks for any help.

    :

    If (getQualifiedClassName (Event.Target) == 'flash. display::MovieClip') {do something}

    else {do something}

    .

  • How to fix the event ID 12507

    Recently, I cloned my C: drive to my second drive E:. I've used Ghost V15. C: was the first partition on disk 0 and E; has been the first partition on disk 1. After a start using Device Management the first partition on disk 0 is E: (system) and the first partition on disk 1 C: (Page File) no player shows that (trunk). If I get all the system files, they show, for example, E:\Windows\system32\drivers. Variable %windir%\System32 shows like E:\WINDOWS.

    I can't tell what disk startup took place, C: or E:. Boot.ini does not reference the second disc. This is so as it initialized from E: but the pagefile is on C: on the second disc.

    How can I fix?

    Any help will be greatly appreciated.

    Event is pasted below-

    Event type: error

    Event source: distributed link followed customer

    Event category: no

    Event ID: 12507

    Date: 18/09/2011

    Time: 17:10:14

    User: n/a

    Computer: HOME-PC

    Description:

    The E: volume ID has been reset, since it was a duplicate of one on C:.  This volume ID is used by distributed link tracking to automatically repair the files, such as the shortened links of the Shell and OLE links, when for some reason any such links will be broken.

    Here's how Device Manager shows my disks-

    Disk 0 Partition 1 E: healthy (System)

    Disk 1 Partition 1 C: healthy (swap file)

    Thank you

    Joe

    I discover that the system starts on the E: drive, which was my original C: drive on device 0. The C: drive active, 1 device, was the original E: drive before the clone.

    I would like to get my system back to where the E: drive is C: and e: C:. All the stuff of the OS on E: and Documents and Settings is on C:.

    Can I copy C:\Documents and setting to e: delete the C: drive that is on my second drive and starts to get the thing back as if they were?

    I can't with cloning, I just need to cancel it.

    Thank you

    Joe

    In addition, my OS is Windows Media Center SP3.

    I fixed it by reinstalling Windows.

    Hello

    You can follow the steps in the link provided below.

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_xp-windows_install/trying-to-clone-a-hard-drive-running-XP-SP3/542ee53f-894a-E011-8dfc-68b599b31bf5

  • How to export the same MB size of my cr2 files in jpg or tiff files in Lr?

    How to export the same MB size of my cr2 files in jpg or tiff files in Lr?

    Let's say that my height is 22 MB, when I export the file in TIFF or jpg, although careful Iam with size of file settings, size, resolution, I can't manioukate how I want it.

    With jpg I tried everything, no matter what I do or a change in file size or meanless remains the same size - 7 mb instead of 22...

    Please advise,

    Best wishes

    T

    You should not even try to do it.

    JPG uses compression technology, so the files will have to be smaller than the original size of your RAWs. In addition, JPGs are 8-bit, while your RAWs are probably 14 bits, so the size needed to store your image will be smaller.

    Thus, there is absolutely nothing wrong with getting a 7 mb JPG of a 22 MB RAW.

  • Shared the event Types Bundle + repository local event = error in the source table

    Hello

    I use a CEP beam for deployment of more types of events common to other Applications. In one application, I declare a type of event locally in the EPN

    i.e.
    <wlevs:event-type-repository>
              <wlevs:event-type type-name="someLocalEvent">
                   <wlevs:properties>
                        <wlevs:property name="someProp1" type="char" length="256" />
                        <wlevs:property name="someProp2" type="char" length="256" />
                   </wlevs:properties>
              </wlevs:event-type>
    <wlevs:event-type-repository>
    And declare it as type of event for the table:
    <wlevs:table id="table1" table-name="TABLE1" event-type="someLocalEvent" data-source="xeDs" />
    Now, I get this error:
    <Unknown event type [someLocalEvent] associated to external data source [table1]> 
    But if I put it in the shared repository event, it works as expected. What happens if the event type is not intended to share? Is it possible to add new types of events locally and he aggregate with shared events?

    Hello

    Can you confirm the "someLocalEvent" and "table1" are defined in the same application?
    It may be wise to ensure that the event type is defined before the table.

    Best regards

  • How to export the list of devices in the Profile Manager?

    Hello

    is there a way to export the list of devices in the Profile Manager on a mini mac running OS Server 5.3?

    Thank you

    How to export data from device in the Profile Manager

    How to export a list of devices and their info?

  • I don't see the event live from the URL indicated. How to join the event online please?

    I don't see the event live from the URL indicated. How to join the event online please?

    At the time you posted this question, the STM sessions had not started yet. The event started at 9:00 PT.  Please let me know if you are still experiencing difficulties to connect.

    Note: all sessions will be available for consultation on request after the event is finished at 1:00 pm PT.

    See you soon,.

    LKR

  • How to export the Indesign to Format XML using JavaScript document

    Hi all...

    Can someone help me, how to export the indesign document to XML Format using JavaScript...

    Thanks in advance...

    doc.exportFile ( ExportFormat.XML, File(Folder.desktop+"/doc.xml" )
    
  • How to export the JPEG to CMYK in LR3?

    How to export the JPEG to CMYK in LR3?

    You pouvez save a JPEG file to CMYK from the printing in LR6 Module.

  • How to export the output document for real cinema screen film

    recently, I made a documentary film. My documentary film was shown in the screen of the great real cinema at the film festival

    However. It was not published in 16 / 9. my film stretched to the size of the screen.

    I filmed with HD and HDV. I used the Canon Mark 2 camera, gopro and sony Z 5

    When I used first pro CS5, I export the movie with H264 (HDTV 1080 p high quality)

    is - this just how I export the movie to screen large cinema with first Pro CS5

    Let me know on this subject?

    The 16:9 screen?

    The size of the screen has nothing to do with it.

    Your image was distorted on the screen?

    If you have exported your 1080 16:9 properly with correct BY etc. and specification of the festival... then they projected in correctly.

  • How to export the indesign file to coreldraw

    Hi all

    I had created a brochure that would be printed to a professional printer. There, they use Indesign. Instead, they use Corel Draw.

    How to export the indesign file created in corel draw.

    and printing

    @Dov, sorry. But there are places on Earth where the upgrade to a more modern workflow just will not happen either by choice, or more often, because of the money. I've dealt with a few printers to India use CD (beautiful dig to Corel, btw) or Illy. Just like that.

    @srikanth977, all printers I treated using an older workflow and equipment that use CD or Illy for output agreed a PDF file. In addition, each of them wanted to PDFX-1A a PDF file without crop marks, bars of color, etc.. So check with your printer. They then add these features when they print.

    Best regards, Mike

  • I get in WSS 3.0 the following SharePoint error: some or all identity references cannot be translated

    I get in WSS 3.0 the following SharePoint error: some or all identity references could not be translated.

    That's when I tried co create a new site or access options in the Central Administration of Sharepoint 3.0, the administrator who created the company and his account has been removed from the pub after this left WSS 3.0 this error pops up, even though I'm an administrator of WSS 3.0, I still get this error.

    Hi Alex,

    Your question is beyond the scope of what is generally answered in this forum of consumer. I would recommend the number of professionals IT on Technet:

    http://social.technet.Microsoft.com/forums/en-us/category/SharePoint2010

  • How to customize the expiration of session WARNING text messages?

    Jdev 11.1.1.4 ALICE BC & ADF Faces

    Requirement: How to customize the expiration of session WARNING text messages?

    I am able to assign the expiry warning time and session time-out period
    <context-param>     
    <param-name>oracle.adf.view.rich.sessionHandling.WARNING_BEFORE_TIMEOUT</param-name>     
    <param-value>300</param-value> 
    </context-param>
    
    <session-config>
        <session-timeout>6</session-timeout>
      </session-config> 
    I want to show a messge like
    ' your session will expire in XX minutes, do you want to continue? "
    Any help will be appreciated.

    ~ Abhijit

    These are other resource strings:

    ...
        {"af_document.PRE_SESSION_TIMEOUT_MSG", "This page will expire unless a response is received within {0} minutes. Click OK to prevent expiration."},
        {"af_document.PRE_SESSION_TIMEOUT_MSG_SECOND", "This page will expire unless a response is received within {0} seconds. Click OK to prevent expiration."},
        {"af_document.PRE_SESSION_TIMEOUT_CONFIRM_TITLE", "Expiration Warning"},
    ...
    

    Timo

  • How to export the vCLI event logs?

    Hi all

    I need your help.

    I would like to know how I can export the log of events by vCLI.

    and if it is possible, what the command is can.

    the purpose of it, we want to make a script to the export of logs automatically.

    We have same operation on vSphere Client, as a result of steps.

    Home-> events-> Export events

    Here's my environment.

    vCLI 5.0

    vCenter Server Version 5.0.0

    5.0 ESXi hosts

    * Power CLI is not installed.

    Thank you in advance.

    Kaori

    Hello

    As much as I KNOW, export event logs can not be done using vCLI.

    It can be done by using the vSphere client as you commented or powercli.

    Best regards

    Pablo

  • How to distinguish the events within an EventHandler?

    Hi all,

    being a newbe in JavaFX I try to distinguish the different eventtypes.

    I try to produce a MouseEventHandler accepting soe as MOUSE_DRAGGED and MOUSE_PRESSED events

    for the calculation of how mouse took and use it to translate my graphics nodes.

    I still don't really understand what is the correct syntax.

    something like

    If (event.getEventType instanceof MouseEvent.MOUSE_PRESSED ())

    {

    ...

    }

    obviously does not work.

    something like

    switch (event... getEventType())

    {

    case MOUSE_PRESSED:

    ...

    }

    also isn't the right way.

    Is it possible to tell them apart?

    Thank you very much in advance

    Malta

    if (event.getEventType() == MouseEvent.MOUSE_PRESSED) {
    // ...
    }
    

    should work.

    I've never done this, fwiw. I always just save different implementations of listener for different event types:

    node.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler() {
         @Override
         public void handle(MouseEvent event) {
              // handle mouse pressed
         }
    });
    
    node.addEventHandler(MouseEvent.MOUSE_RELEASED, new EventHandler() {
         @Override
         public void handle(MouseEvent event) {
              // handle mouse released
         }
    });
    

    In Java 8 this will get much less verbose (using lambda expressions).

Maybe you are looking for

  • Cannot switch on Airplay

    I have an iMac 2012 end El Capitan running.  When I click on the airplay icon, it shows it's off.  There is no option to turn on! Any suggestions?

  • A copy of Mac OS 9.2.1 detail or higher

    I had a snow iBook G3 and I want to install Mac OS 9 on my iBook G3 Snow. I got me a copy of Mac OS 9.1, but 9.1 is not compatible with my model (and Yes, I tried). Anything Mac OS 9.2.1 or don't work anymore. I've seen "Update" CDs, but do not know

  • How to use sticky keys?

    I have rsi and coordination/proprioception problems, so I can't type without looking at where I tape and cannot coordinate both hands, can not use some grips and cannot use contact devices unless I can turn off the tapping and disable most of the mov

  • (xp) My computer was recently reset settings default to someone, (now disappeared). Now the driver for my scaner seems to be lacking, how can I find?

    I had a colleague working on my computer, it invalidates many functions, because I received a message from "High CPU".  So he re-set my computer default settings.  I have a scaner/printer Epson Workforce that communicates is no longer with my compute

  • Ventana desplegable

    Hola, Doing the Programación en labview estoy para monitorizar los UN autómata Street. Puedo leer todos los Street pero me gustaria organizarlos por grupos y cada grupo estuviera tras una ventana desplegable layer. ¿Alguien me can help para hacer est