Merge several releases by e-mail to singlemail

Hi all

Can someone help me complete this script.

My question is with the script below, I can send error report of each vcenter as a simple mail, but I need all the vcenter error report output connected in a singlemail.

$allvcenterservers = "vcenter1","vcenter2","vcenter3","vcenter4"
foreach($vcenterserver in $allvcenterservers){
$cred = Get-VICredentialStoreItem -User domain\user -Host $vcenterserver  -File C:\cred.xml
Connect-VIServer -Server $cred.Host -User $cred.User -Password $cred.Password | Out-Null
$daysback = 1
$report = @()
$report+= Get-VIEvent -Types Error -maxsamples ([int]::MaxValue) -Start (Get-Date).AddDays(-$daysback) |
Select @{N="Vcenterserver";E={$vcenterserver}},
@{N="Type";E={$_.GetType().Name}},
@{N='CreatedTime';E={$_.CreatedTime}},
@{N='User';E={$_.UserName}},
@{N="Message";E={$_.FullFormattedMessage}}
$CurrentDate = Get-Date -Format 'MM-dd-yyyy_hh-mm-ss'
$filename = "C:\eventreport on $vcenterserver -$($CurrentDate).csv"
if($report.Count -eq 0){
}
else{
$report |Export-Csv -Path $filename -NoTypeInformation -NoClobber -UseCulture
Send-MailMessage -From "[email protected]" -To "[email protected]" -Subject "Error Events on $vcenterserver" -Body "The attachment contains all error events which are triggered from past 24hrs on $vcenterserver" -Attachments $filename -SmtpServ.com'
}}

I don't think CSV spreadsheets media, it will have to be a XLSX file in this case.

I used the ImportExcel of Doug module to make it easier. I strongly advise to use this module, it does not require the installation of Excel (ideal for scripts that run on the servers).

$allvcenterservers = "vcenter1", "vcenter2", "vcenter3", "vcenter4".

$CurrentDate = get-Date-Format "MM-dd-yyyy_hh-mm-ss.

$filename = 'C:\eventreport-on-$ ($CurrentDate) .xlsx.

{foreach ($vcenterserver to $allvcenterservers)

$report = @)

$cred = get-VICredentialStoreItem-user domain\user-host $vcenterserver - file C:\cred.xml

SE connect-VIServer-Server $cred. Home - user $cred. Username-password $cred. Password | Out-Null

$daysback = 1

$report += get-VIEvent-type error - maxsamples ([int]: MaxValue)-start (Get-Date). AddDays(-$daysback) |

Select @{N = "Vcenterserver"; E = {$vcenterserver}},

@{N = ' Type'; E={$_. GetType(). Name}},

@{N = "Createduserid"; E={$_. Createduserid}},

@{N = 'User'; E={$_. User name}}.

@{N = 'Message'; E={$_. FullFormattedMessage}}

if($Report.) County - not 0) {}

$report | Export-Excel-path $filename - $vcenterserver - AutoSize WorksheetName - FreezeTopRow

}

}

"Send-MailMessage-to"[email protected]"- to"[email protected]"- subject" error events on $($vcenterserver) ""

"- Body" the attachment contains all error events that are triggered from the last 24 hours on $($vcenterserver) ""

-Spare part $filename - SmtpServer 'smtpserver.com '.

Tags: VMware

Similar Questions

  • How to merge several documents to my e-mail to adobe in Windows?

    How to merge several documents to my e-mail to adobe in Windows?

    Hi lindas27936780,

    Download PDF attachments on your system & then combine them combine or merge files into a single PDF, Adobe Acrobat DC

    Kind regards

    Meenakshi

  • How to merge several layers in one without destroying the layers of origin?

    How to merge several layers in one without destroying the layers of origin?

    joelb2995629 wrote:

    How to merge several layers in one without destroying the layers of origin?

    The solution is a very useful shortcut, but requires a bit of dexterity.

    Of is it: Ctrl + Alt + Shift + e. (Yes, 4 keys at the same time).

    This creates a new layer that is the fusion of visible layers.

    To be on the top layer and don't have ensure that active useful layers.

  • How "merge" several duplicate layers together to make a single image?

    How "merge" several duplicate layers in the same image, (each of them with a number painted on it) in an image, which shows all the numbers separated, that is are coalition? Believe me, I tried all means to do, but nothing helps, I just can't 'merge' into a single image. Help, please! I use Photoshop cc with windows 7.

    Select all layers, and then press ctrl-alt-shift-e. This will create a composite of all layers, leaving your only originals.

    Each layer must have a mask or pixels removed to create a transparent box that allows to display the image in the next layer below and so on. This must be done before you create the composite.

  • How to merge several pdf files into an editable word document?

    How to merge several pdf files into an editable word document?

    You will need either a subscription to the pack PDF to merge the files, then export to Word or you would need Adobe Acrobat (should not be confused with the free Adobe Acrobat Reader which can not do).

  • Hi, I currently pay monthly to the handset Lightrrom 5/Photoshop but I need to be able to merge several images in "Merging HDR" but is not one of the options I can choose currently highlighted.  I guess I'll have to move to Lr 6 but I"

    Hi, I currently pay monthly to the handset Lightrrom 5/Photoshop but I need to be able to merge several images in "Merging HDR" but is not one of the options I can choose currently highlighted.  I guess I'll have to move to Lr 6 but I am struggling to see online how to change the plan?

    I suppose you're running a 32-bit Windows version - if PS CC 2015 is available but LR CC 2015 is not.

    Help / System Info in LR 5 and look for Application Architecture and System Architecture a few lines down in the list of information.   Something with a 32 or x 86 is 32-bit.  Something with x 64 is 64-bit.

    You will need a 64 bit OS to run LR CC or LR 6.

  • How to merge several PDF files into a PDF file?

    How to merge several PDF files into a PDF file? for example, I've scanned 3 pages of the same document on my computer and they come up on top of the computer as a separate PDF files, but they are 3 pages that should be in the same PDF file?

    Hi m.zaffar,

    In order to combine the PDF you can subscribe to Adobe PDF to combine files of service https://cloud.acrobat.com/combinepdf

    KB doc. for help Document Cloud Help | Adobe PDF package using.

    Or

    You can use the Acrobat free trial download Adobe Acrobat application | Acrobat Pro DC.

    KB doc. using Acrobat help. Combine or merge files into a single PDF file.

    Kind regards

    Nicos

  • Can I merge several PDF on a list of PDF and order

    For example
    Let's say I have 5 pdf queries with 5 page report layouts
    I can do a page of APEX to select one or more to be put in a single PDF and also have the order in which they appear in the file a PDF?
    Help, please
    Thank you
    Doug

    BI Publisher comes with a java API that allows you to merge several PDF files.
    Made custom coding is possible - so I'm not an expert of the APEX - so I can't
    talk about how integrate it APEX.

    Klaus

  • merge several *.dat files in a single *.dat file

    Hallo,

    I have several measure *.dat files. How to merge files it is to have one file? I want a *.dat file can be traced graphic.

    Should I create a separate vi?

    Or

    Must use addons toolkit in labview?

    Please help me...

    Thank you

    respect,

    Chaoui

    Hi macan,.

    Only, I've attached a screenshot of my diagram of blocks on the merging of files. Here already a few three dat files IE 1.dat, 2.dat, and 3. dat, I created and I'm

    trying to merge all the dat files 1. itself.

    Thank you and best regards,

    srikrishnaNF

  • my account has been hacked several times and sends mail spam to the people on my list

    my account has been hacked several times and is to send spam to people on my list. I changed my password several times and it continues to happen. I took everyone off my email list with the exception of an e-mail address that I created to alertme in the case of this kind of thing happens, it works. I pay for this msn messaging service and I'm upset that anyone can hack my email so easily. I want that stopped.

    It is up to you to use Kaspersky Rescue Disk 10 to remove any malware. The hot spare is a bootable Linux distribution that will search for and remove malicious software that can hide when the HD is active.
    Booting from the rescue disk will ensure the HD is not Active -Kaspersky Rescue Disk 10

    Once the system is cleaned up, contact MSN and ask another reset of password.

    Expert MowGreen Windows IT Pro - consumer safety

  • Merge several files in many subfolders in a single folder tree

    I have several sets of records, each with several subfolders, trees each subfolder that contains several files. I would like to merge all this into a single folder tree, maintaining the same subfolder structure and each subfolder containing a single set of files, eliminating all inevitable duplicates of the merger.

    Do this manually with Windows Explorer, it is painful and long. I have to select all the files in any subfolders, and then drag the selection to the subfolder in the main folder tree, choose 'move and replace' and check "do the same for the next x conflicts and repeat this process for each of the many secondary issues."

    Although I did an online search before posting this call for assistance, I have saw that of the utilities that will merge all files into multiple files in a single folder, I saw not a utility that will do what I need.

    I hope that someone will know of a utility that will allow me to win this manually for the next years!

    Thank you in advance.

    useful43

    The solution proved to be easier than I thought.

    Rather that you select all of the files in each folder separately, which was painful and long, I chose each tree at once, and Windows Explorer did the rest, as it did before.

    Concerning

    useful43

  • Data merge several people on one page

    I create a file of data merge to create a travelogue of emergency contacts. The previous file was done in Publisher (YUCK) and needs to be rethought. I'm trying to set up the file properly in InDesign to perform a data merge in which there are 3 contacts per page (one primary, secondary and substitute for each county in New York). See below

    Publisher File Screen Shot.jpg

    Currently, I can't figure out how to get multiple contacts on a single page. The way it is set up now, I can get information for a person to appear on each Board.

    InDesign Screen Shot.jpg

    Any ideas on how to help?

    You have the same problem with which I tried to help in this thread: repeat pages

    As you've found data merge InDesign really only merges a record of several sets of fields... OR (what you want)... multiple records to a set of fields.

    So what you need is just a set of fields; one. Follow these steps:

    And delete everything except the first page.

    1. Now, with emphasis on the page of the document (and not his mistress), choose Create a merged Document in the data merge Panel menu.
    2. Tab records the dialog box create a merged Document, choose multiple records in the accounts rendered by menu Page of the document.
    3. Check the box saw several shot record.
    4. Switch to Multiple record layout tab and set the controls to set folders as desired (3 per page) while previewing in real-time.
  • Is it possible to merge several websites of muse?

    My site has a lot of different pages, and he began to muse slow down a bit. Is it possible to create several sites muse and merge them when I publish them?

    If not,

    Is it possible to create several subdomains and have the my links go subdomains? If possible, I need to know how to have an image link to a subdomain.

    Thank you!

    You can publish multiple sites on the same FTP server, but you do not want to use folders separated for each "site" or the section of the site to avoid conflicts with the names of your page.  You would connect to these sections in your homepage to the 'main' sites as you would other pages on a site. We do not recommend this however as possible rather difficult to maintain.

    However, you may find that the new version of Muse CC out allows that there are has some improvements in the management of the site which is a large site that covers much more easy.  You can see the help in your current version of Muse and join the beta program to check these features in the current beta.

    See you soon,.

    Justin

  • Data merge - several documents in 1 Page

    OK, I searched the forum for this issue. There are always similar responses, but my problem is unique.

    • I'm doing an invoice that shows how many services they bought, how much are these services and how much they have.
    • I exported a CSV of 1,500 customers in a separate program.

    The issue is that the. CSV file sorts each service on a different line.

    FOR EXAMPLE

    A                   B                    C               D          E          F

    1 1 John Smith 12345 Street City State of a $100.00 service

    2 service 2 John Smith 12345 Street City State $25.00

    3 service 3 John Smith 12345 Street City State $ 50.00

    4 service 4 John Smith 12345 Street City State $ 75.00

    5 service state of city street Jack Brown 12345 $1 100.00

    6 service 2 Jack Brown 12345 Street City State $25.00

    7 service 1 Mary Johnson 12345 Street City State $ 50.00

    8 1 Nick Stewart 12345 Street City State $ 75.00 service

    (just colors indicate different customers)

    Rows 1 to 4 must be on a single page, 5-6 on the next page and so on. Is there a way to filter in order to enter the order of similar files on the same page? All lines containing "John Smith" would be filtered in the sequence on the same page.  Does anyone know how to do this?

    You must change the way that your reports are generated. ID lacks the sophistication to merge the data to do so. You want all the data related to each customer in one record and release a record per page.

  • SELECT and add to the release of e-mail

    Hi guys,.

    I am trying to take the records in a table and place them in an email to myself. Works by email basis (without any select statement) so the question is recovering and by including the data in the table. My code is:
    DECLARE
      v_From      VARCHAR2(80) := 'C3.Weekly';
      v_Recipient VARCHAR2(80) := '[email protected]';
      v_Subject   VARCHAR2(80) := 'HKADM C3 Stats Fail - ' || to_char(sysdate,'DD') || ' ' || 
            rtrim(to_char(sysdate,'Month'), ' ') || ' ' || to_char(sysdate, 'YYYY');
      v_Mail_Host VARCHAR2(30) := 'smtp.XXX.com';
      v_Mail_Conn utl_smtp.Connection;
      crlf        VARCHAR2(2)  := chr(13)||chr(10);
      db_fail VARCHAR2(4000);
    BEGIN
    SELECT DISTINCT TBS_SVC_NAME into db_fail
           FROM hkadm.TBSTAT
           ORDER BY 1;
     v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25);
     utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
     utl_smtp.Mail(v_Mail_Conn, v_From);
     utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
     utl_smtp.Data(v_Mail_Conn,
       'Date: '   || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
       'From: '   || v_From || crlf ||
       'Subject: '|| v_Subject || crlf ||
       'To: '     || v_Recipient || crlf ||
       crlf ||
       
    ' The following databases failed to commit:');
     utl_smtp.Quit(v_mail_conn);
    EXCEPTION
     WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
       raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
    END;
    /
    I get the error "ORA-01422: exact fetch returns more than requested, number of lines and ORA-06512: line 11. Then, I thought that maybe I had to make a loop on the variable but then he complained that there is a FOR: s any help appreciated.

    Mike

    Hello

    It seems that you get several lines that is not possible to store in a variable 'db_fail '.

    How about using the loop in a cursor.
    for example:

    Declare
    cursor c1 is SELECT DISTINCT TBS_SVC_NAME
    OF hkadm. TBSTAT
    ORDER BY 1;

    Begin

    FOR db_fail in c1
    LOOP
    v_Mail_Conn: = utl_smtp. Open_Connection (v_Mail_Host, 25);
    UTL_SMTP. HELO (v_Mail_Conn, v_Mail_Host);
    UTL_SMTP. Mail (v_Mail_Conn, v_From);
    UTL_SMTP. RCPT (v_Mail_Conn, v_Recipient);
    UTL_SMTP. Data (v_Mail_Conn,
    ' Date: ' | TO_CHAR (sysdate, ' Dy, hh24:mi:ss DD month YYYY ') | CRLF.
    ' De : ' || v_From | CRLF.
    "Subject: ' |" v_Subject | CRLF.
    ' De : ' || v_Recipient | CRLF.
    CRLF.

    "The following databases could not commit :');
    UTL_SMTP. Quit (v_mail_conn);

    END OF LOOP

    See you soon
    Anurag Tibrewal

Maybe you are looking for

  • Auto-effondrement in the library window and the dialog "change a bookmark this ', the last folder expanded

    In the tree of files of the window Library (bookmark and history) and the folder hierarchy of the dialog "edit this bookmark/New Bookmark', once a folder is developed, it will not collapse until the user manually clicks again expando button. Overtime

  • Strange noises with my Tecra

    My Tecra makes a noise slamming when I work. I guess that's the drive hard, but not sure. I don't think it's normal because I never heard other machines popular as strong snap. In addition, one of my friends use the same machine in his office and doe

  • Question - Yahoo Calendar Emails to display graphic / Web pages

    Hello, I have Windows Vista and recently downloaded Google Chrome as my browser. I started having random graphs display problems, an example is shown in the image below, which is a connection on AAA.com. It occurs on all Web sites. In addition, I use

  • Fix for CSCsi24458

    Hello where it is possible to secure the release of fixed (7.2 (2.20)) for this Bug - ID? Kind regards. Volker

  • Adobe Captivate Question 9-Animation (path)

    I am currently working in Adobe Captivate 9 and fight with some paths.  I've got some grouped items (an example: a piece of the puzzle is grouped with a text box) and want to evolve together on a path.  This trajectory looks great in the preview, the