inventory including the last report date of extinction

Hello

I'm new to power cli (about a week to try) and am trying to run a powercli script that will give me a list of off the virtual computer with specific information, including the date, it has been turned off. My script looks like this:

@"
===============================================================================
Title: vminventory.ps1
Description: Export VM Information for vCenter in one. CSV file for import into what anyone
Use:.\vminventory.ps1
Date: 15/10/2012
===============================================================================
"@
# Get virtual center to connect to:
$VCServerName = Read-Host "What is the name of Virtual Center?"
$ExportFilePath = Read-Host "where you want to export the data?
$VC = to connect-VIServer $VCServerName
$Report = @)
#$VMs = get-file $VMFolder | Get - VM
$VMs = get - vm | WHERE-object {$_.powerstate - eq "poweredoff"}
$Datastores = get-Datastore. Select Name, Id
$VMHosts = get-VMHost | Select Name, Parent
# Get turned off from the time of the event:
{ForEach ($VM to $VMs)
Get-VIEvent-body $VM - MaxSamples ([int]: MaxValue) | where {$_-is [VMware.Vim.VmPoweredOffEvent]} |
Group-object - property {$_.} Vm.Name} | %{
$lastPO = $_. Group | Tri-objet-property Createduserid-descending | Select - 1 first | Select Createduserid - ExpandProperty
New-object PSObject-property @ {}
VM = $_. Group [0]. Vm.Name
"The last Poweroff" = $lastPO
}
}
$VMView = $VM | Get-View
$VMInfo = {} | Select VMName Powerstate, OS, IPAddress, ToolsStatus, host, Cluster, data store, NumCPU, MemMb, DiskGb, SSGOwner, BUSowner, PowerOFF, Note
$VMInfo.VMName = $vm.name
$VMInfo.Powerstate = $vm. PowerState
$VMInfo.OS = $vm. Guest.OSFullName
$VMInfo.IPAddress = $vm. Guest.IPAddress [0]
$VMInfo.ToolsStatus = $VMView.Guest.ToolsStatus
$VMInfo.Host = $vm.host.name
$VMInfo.Cluster = $vm.host.Parent.Name
$VMInfo.Datastore = ($Datastores | where {$_.}) ID-match (($vmview.)) Data store | Select - first 1) | Select the value). Value} | Select name). Name
$VMInfo.NumCPU = $vm. NumCPU
$VMInfo.MemMb = [math]: round (($vm.)) (MemoryMB), 2)
$VMInfo.DiskGb = [math]: Round ((($vm.)) Hard drives | Measure-Object-CapacityKB property-sum). Summary * 1 k / 1 GB), 2)
$VMInfo.PowerOFF = $lastPO
$VMInfo.SSGOwner = ($vm |) Get-Annotation - CustomAttribute "SSG system owner"). Value
$VMInfo.BUSowner = ($vm |) Get-Annotation - CustomAttribute "Business system owner"). Value
$VMInfo.Note = $vm. Notes
$Report += $VMInfo
}
$Report = $Report | Sort-Object VMName
IF ($Report - don't ' ') {}
$report | Export-Csv $ExportFilePath - NoTypeInformation
}
$VC = disconnect VIServer $VCServerName - confirm: $False

I can't get to browse and read the power of the events in the log of the events on the virtual machine?  Someone at - it ideas?

No, my mistake. Which should have been $lastPO.VM.VM.

I've corrected the above code

Update: just noticed another typo, it's fixed

Tags: VMware

Similar Questions

  • Mozilla, your last update does not include the last cert of intermediaries of extended validation from Verisign, Symantec class 3 EV SSL CA - G2, please fix ASAP

    Your last update of firefox, Mozilla does not include the last cert of intermediaries of extended validation from Verisign, Symantec class 3 EV SSL CA - G2, please fix ASAP

    Firefox never includes the intermediate certificates.
    It is the responsibility of a server to include all the intermediate certificate required to make it possible to build a certificate chain that ends with a trusted root certificate embedded.

    Note that Firefox automatically records the intermediate certificates that servers send in certificates for future use Manager (they appear labelled as 'Software security device' in the References tab).
    If a server does not send a complete certificate chain then you get an untrusted error when Firefox has stored missing intermediate certificates to visit a server in the past that a send it, but you get an untrusted error if this intermediate certificate is not yet registered.

  • The speed of the processor 1 group 0 is restricted by the system firmware. The processor has been in this state of reduced performance for 4 seconds since the last report.

    The speed of the processor 1 group 0 is restricted by the system firmware. The processor has been in this state of reduced performance for 4 seconds since the last report.

    Event ID: 37
    Source: Kernel-processor-Power
    Task category: 7

    -What it means and how to fix this?

    : S

    Make sure that the system has sufficient cooling, and that you have upgraded the BIOS most recent.

  • Include the expected start Date and end Date for the management of SSHRC-Absence

    Is it possible to include the scheduled Start Date and end Date of project to SSHRC, management of absences with the type of leave is confirmed?

    Thanks in advance

    Hello

    In this case, you should disable the option the absence request, so that by default all sheets are confirmed and the user do not have to apply once leave as planned and then comply.

    You can see the id metalink - "How do I disable the State of Absence of R12 Absence Management Page [ID 786691.1]" to understand how to disable "Planned" option to request authorization for simple customization.

    It will be useful.

    Thank you
    Sanjay

  • Extract the last opening date of session using Groovy?

    Is it possible to extract the last opening date of session of the user via a Groovy script?  I went through the scheme, but I don't have the slightest idea how to begin to know where there.

    Ideally, I'd end up with a list that displays the name of each user connection and date of last connection.

    Try this:

    msg = new StringWriter()

    SS = server. SecurityService;

    FMS = server. HaMembershipService.getHostName)

    Msg. Append ("FMS; Foglight ID; Foglight roles; lastLogonTS; logonCount; statusDesc; logonType; createdTS\n')

    (user) {ss.findAllUsers ()}

    Msg. Append (FMS). Append(";")

    Msg. Append (User.Name). Append(";")

    List =]

    for (secRole in ss.getAllRolesForUser (user.name)) {list += secRole.name}

    Msg. Append("["). Append (List.Join(",")). Append("];")

    Msg. Append (User.lastLogonTS.ToString ()). Append(";")

    Msg. Append (User.logonCount.ToString ()). Append(";")

    Msg. Append (User.getStatusDesc ()). Append(";")

    If (User.isExternal ()) {msg.append ("external ;")}

    Else {Msg.Append ("Internal ;")} ")}

    Msg. Append (User.createdTS.ToString ()). Append ("\n")

    }

    return msg;

  • How to find the last update date, time and user of the file field peoplecode

    How to find the last updated date time fields of peoplecode records?

    Thank you.

    We can check the update date-time using the following query

    SELECT LASTUPDDTTM IN THE PSPCMPROG WHERE OBJECTVALUE1 LIKE "RECNAME" AND OBJECTVALUE2 AS "FIELDNAME".

  • To find the last year data / data of the year an individual

    Hello

    How to find the data for the whole of last year, I tried like

    entered_date between to_char (December 31, 2008 11:59:59 ', ' HH12:MI:SS MM/DD/YYYY ')
    and to_char (1 January 2010 00:00:00 ',' DD/MM/YYYY HH12:MI:SS'), but it's an error invalid number.

    Thank you.

    Hello

    If you want something that doesn't require you to hardcode a year, but the numbers automatically in what year it is:

    WHERE   entered_date     >= ADD_MONTHS ( TRUNC (SYSDATE, 'YEAR')
                                              , -24
                                    )
    AND     entered_date     <  ADD_MONTHS ( TRUNC (SYSDATE, 'YEAR')
                                              , -12
                                    )
    

    There are a couple of things to notice on the expression that you posted (in addition to using TO_CHAR TO_DATE instead):

    WHERE  entered_date     BETWEEN TO_DATE ('12/31/2008 11:59:59', 'MM/DD/YYYY HH12:MI:SS')
                          AND       TO_DATE ('01/01/2010 00:00:00', 'MM/DD/YYYY HH12:MI:SS')
    

    BETWEEN includes two end points, so the phrase above covers just a little over a year. It includes a second of 2008 and a second in 2010, as well as the whole of 2009.

    Currently, 2010 is the last year, so the expression you have posted (as well as my suggestion) is actually for the year before last year, but it can easily be changed for the whole year.

  • XY-do graphics as the record of the last 100 data points

    Hello!

    I'm trying to plot data over a period of about 110 s (99Hz sampling frequency). The problem is that the XY-graph I use seems to collect only the last 100 samples for some reason any. I do something wrong or is it just a property that is interchangeable?

    Hi Aleksi,

    You may not set up "BuildXYGraph" more accurately? Like turning off the only option of this ExpressVI?

  • Drop database connectable to including the file system data sheets files

    I did experiments with the connectable Oracle12c to database functionality and have noticed that when I "drop database connectable to pdb1 including datafiles', I get the message that the database snap-in has been dropped."  I also see that all files in the tablespace for the PDB except the SYSTEM data file have been deleted.


    I want to remove the folder that has been used for the pluggable database after that the PDB fell, but cannot because the file SYSTEM data is left behind.

    Is it possible to delete the data file SYSTEM for a pluggable database once he fell?  Or this part forever from the database of the container?

    Thank you

    This forum works on a Server Windows 2012.

    Thanks for the Bug information.  There is no error in the alert.log file, but I found a trace file with:

    ORA-01265: cannot remove the D:\ETC\ETC\SYSTEM01 DATA. DBF

    ORA-27056: could not delete file

    OSD-04024: cannot delete the file.

    S/O-error: (32 OS) the process cannot access the file because it is being used by another process.

    This seems to be the same problem as described in bug 17659954, so I can follow in investigating the recommendations of bug

    Thanks again

  • SQL to generate the last weeks date (not a stored procedure)

    I need SQL to generate the last dates of weeks from Monday to Sunday. I don't want to use the data in the table or the stored procedure. I need inline SQL. Please help me with your suggestions. Thanks in advance for the help.

    Varun says:
    I need SQL to generate the last dates of weeks from Monday to Sunday. I don't want to use the data in the table or the stored procedure. I need inline SQL. Please help me with your suggestions. Thanks in advance for the help.

    below should help you get started

      1* SELECT SYSDATE-LEVEL from dual CONNECT BY LEVEL < 8
    SQL> /
    
    SYSDATE-L
    ---------
    21-APR-13
    20-APR-13
    19-APR-13
    18-APR-13
    17-APR-13
    16-APR-13
    15-APR-13
    
    7 rows selected.
    
  • If the record not found this particular date, then select the last recordings date.

    I have three columns
    Number DP_FND_CODE;
    Date of DP_DATE;
    Number DPPRICE;

    I want that if dp_uprice not found this particular date (: dd1) then
    Select maximum Dp_uprice that the date would be less then: dd1

    Example: -.
    I run query and :DD1 parameter = 18/10/2010
    
    SELECT dp_fnd_code, dp_date , dp_uprice dpprice 
    FROM dailyprice where dp_date = :dd1
    
    DP_FND_CODE DP_DATE                      DPPRICE
    ----------- ----------------------- ------------
              1 18/10/2010                  109.0344
              2 18/10/2010                   10.1045
              3 18/10/2010                  100.4010
              4 18/10/2010                  102.3276
              6 18/10/2010                   14.6958
              7 18/10/2010                   98.8300
              8 18/10/2010                  102.0900
    It will show that all the Archives: dd1 = 18/10/2010, you can see above the result of the query DP_FND 5 is missing.
    I want to if there is no DPRICE of that particular date (: DD1) then it shows the date of the last DPPRICE.
    Like this
    DP_FND_CODE DP_DATE                      DPPRICE
    ----------- ----------------------- ------------
              1 18/10/2010                  109.0344
              2 18/10/2010                   10.1045
              3 18/10/2010                  100.4010
              4 18/10/2010                  102.3276
              5 16/10/2010                  122.3276          
              6 18/10/2010                   14.6958
              7 18/10/2010                   98.8300
              8 18/10/2010                  102.0900
    so I used this query, but correct nicely.
    SELECT dp_fnd_code, dp_date, 
                 case when dp_uprice is null then(
               select max(dp_uprice) dpprice from dailyprice where dp_date < :dd1 group by dp_fnd_code,dp_date
               ) else dp_uprice  end dpprice 
      FROM dailyprice 
      where dp_date = :dd1
      order by dp_fnd_code
      
    Thanks in advance.
    SELECT dp_fnd_code,
           max(dp_date) keep (dense_rank last order by dp_date),
           max(dpprice) keep (dense_rank last order by dp_date)
      FROM dailyprice
      where dp_date <= :dd1
      group by dp_fnd_code
      order by dp_fnd_code;
    
  • How to insert the last updated date and user id to a form?

    Hello

    I created a form to enter data into a custom table.
    When a new record is created, I want to keep track of the date created, last updated date, and who (user id) enters the form.

    Can you please help or point me to a good place to look for this information?

    Thank you!
    LC

    Create four new columns in your table called Created_On, Created_By, Last_Updated_On and Last_Updated_By.

    You can create a trigger for the rest:

    create or replace trigger ""
      before insert or update on ""
      for each row
    begin
      if inserting then
        :NEW.Created_On := sysdate;
        :NEW.Created_By := v('APP_USER');
      end if;
    
      if updating then
        :NEW.Last_Updated_On := sysdate;
        :NEW.Last_Updated_By := v('APP_USER');
      end if;
    end;
    

    Whenever you will add or modify data in this table, the trigger will automatically fill these fields.

    Kind regards
    Mathieu

  • How to order by the last two dates?

    Hello

    I try to get the result in a table with the highest of the two dates. First date is a date created_on, the second date is "updated_on". I want to display the rows ordered by the last day between these two.

    I've tried this application without result.
    SELECT 
      name "Nom",
      updated_on, created_on,
      greatest (updated_on, created_on) latest
    FROM  doclib_documents
    order by latest desc
    Below is an example of the table data.
    Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('readme.txt',to_timestamp('08/03/2010 15:16:56','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('12/03/2009 11:22:41','DD/MM/RR HH24:MI:SSXFF'));
    Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('doc_library_readme_0.92.txt',to_timestamp('12/02/2010 13:32:30','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('12/03/2009 11:26:14','DD/MM/RR HH24:MI:SSXFF'));
    Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('01_informatique.pdf',to_timestamp('10/02/2010 13:49:34','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('12/03/2009 16:29:00','DD/MM/RR HH24:MI:SSXFF'));
    Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('readme.txt',to_timestamp('08/03/2010 15:16:56','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('16/02/2010 11:40:16','DD/MM/RR HH24:MI:SSXFF'));
    Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('dataguardproblem.txt.txt',to_timestamp('03/03/2010 11:19:44','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('16/02/2010 11:41:03','DD/MM/RR HH24:MI:SSXFF'));
    Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('f110.sql',to_timestamp('03/03/2010 10:59:08','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('10/02/2010 13:44:45','DD/MM/RR HH24:MI:SSXFF'));
    Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('1.jpg',to_timestamp('08/03/2010 14:22:00','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('08/03/2010 14:17:42','DD/MM/RR HH24:MI:SSXFF'));
    Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('dads.conf',to_timestamp('03/03/2010 11:19:56','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('09/02/2010 11:19:30','DD/MM/RR HH24:MI:SSXFF'));
    Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('1.doc',to_timestamp('10/02/2010 13:49:46','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('09/02/2010 11:20:28','DD/MM/RR HH24:MI:SSXFF'));
    Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('1.doc',to_timestamp('15/02/2010 16:08:06','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('09/02/2010 11:33:02','DD/MM/RR HH24:MI:SSXFF'));
    Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('dataguardproblem.txt.txt',to_timestamp('03/03/2010 10:57:52','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('09/02/2010 11:36:15','DD/MM/RR HH24:MI:SSXFF'));
    Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('access.rtf',to_timestamp('10/02/2010 13:38:25','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('09/02/2010 12:10:57','DD/MM/RR HH24:MI:SSXFF'));
    Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('temp.sql',to_timestamp('12/02/2010 14:43:58','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('11/02/2010 09:59:56','DD/MM/RR HH24:MI:SSXFF'));
    Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('evv_E022_doublons.txt',to_timestamp('15/02/2010 15:55:02','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('12/02/2010 15:59:45','DD/MM/RR HH24:MI:SSXFF'));
    Insert into "table_export" ("Nom",UPDATED_ON,CREATED_ON) values ('evv_E022_doublons.txt',to_timestamp('15/02/2010 16:05:58','DD/MM/RR HH24:MI:SSXFF'),to_timestamp('12/02/2010 16:00:25','DD/MM/RR HH24:MI:SSXFF'));
    Thanks for you help!

    Christian

    It does not work for me

    select t.*, greatest(updated_on, created_on) latest_date
      from "table_export" t
    order by latest_date desc
    
  • Import notes that in SOD - how to set the last-modified Date?

    We are still doing our Siebel users. We launched on-air, and therefore some users who were still using legacy systems while some worked far in Siebel. What I'm trying to do now is to take over from representatives in the old system and go to Siebel. I have the file created with the subject, external account id, note (description) and the date that the note was created in the old system. When I try to import the date cannot be set and is broken at the time of that creation of the acutal in Siebel note.

    It is a problem that I have 3 years of account history that should be loaded and if I import all of this now, it will push the notes in the system to bottom of the list who will be upset representatives began uisng Siebel in the first wave.

    My goal is simply to be ordered from oldest to newest on top, but I can't seem to find a way to do that using the tool of importation as a last modification Date is not an option for me to import.

    Is it possible to do? If not, anyone know of a work around to achieve the same goal?

    Any help is very appreciated.

    -john

    It wouldn't appear in the Notes section of the retail account. Currently, it is not possible to import the date as part of an import of Notes.

  • We can access the wise report date?

    Hi all
    can access us report date wise if yes, then please guide me?

    I did text items two, one for the start date and a second for date end in form.if I have date in these two text like that elements

    start date: 08/01/2009 end date: 08/08/2009 and after pressing the when_button_pressed and he give me the report up to the indication of date, is possible?

    Please help me and me more guide

    Thanks in advance

    Sarah

    He must put that in your report query, not anywhere in the form.

Maybe you are looking for

  • Payment help

    I need help with my payment & Billing for iCloud information

  • my bit defender can't seem to get rid of malware called OSX/InstallMiez need help

    I have a Mac with OSX EL Capitan my bit defender 2014 I can't seem to get rid of malware called OSX/InstallMiez. Need help thanks in advance

  • P10 - 554 display driver problem

    When running games like COUNTER-STRIKE 1.6, my FPSthat drops to 30 - 40.BTW, i had would download the newestgraphics driver "display-s-p-xp-4485", which is published on 08/05/2004, but failed to put up-to-date. WheneverAfter installing the new driver

  • Persistence of objects called from C screws

    In my first case, I have a single VI compiled into a DLL. This VI carries three different operations, according to the function call: It is the first operation. It opens a connection to a UDP stream server. 'ID' and 'SA' are commands to tell the serv

  • Installation problems and fix missing cache

    I installed Turbo tax before on my computer, but this time it will not install and gives an error. I ran Mr fix and it tells me I have the patch cache corrupted or missing. I downloaded all the updates and still the same. Any ideas?