Email CollectOverMetrics.ps1 HTML Report

Exchange 2013 SP1 with 2 member DAG with 1 DB. I want to monitor the DAG using collectovermetrics.ps1. I want to have the html report from collectovermetrics.ps1 email to administrators. I know I have to have task scheduler run the command:
CollectOverMetrics.ps1 -DatabaseAvailabilityGroup DAG1 -StartTime "06/15/2012" -EndTime "06/16/2012" -GenerateHTMLReport –ShowHTMLReport
But how do I have that report emailed? I know you can use:
Send-MailMessage -To [email protected] -From [email protected] -subject "This is a test" -Credential (Get-Credential)
But this fails with:
send-mailmessage : The email cannot be sent because no SMTP server was specified. You must specify an SMTP s
using either the SmtpServer parameter or the $PSEmailServer variable.
At line:1 char:1
+ send-mailmessage -to [email protected] -from [email protected]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Send-MailMessage], InvalidOperationException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.SendMailMessage
Can anyone help with this?

We don't know what's going on when you run Scheduled Tasks with this cmdlet so let's separate the script and scheduled tasks.
Create a file called "C:\Scheduled Tasks\Collect Metrics.cmd" and add below content (don't add -WindowStyle Hidden which will make the window invisiable)
REM ----------------------------- Start
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -command ". 'C:\Scheduled Tasks\Collect Metrics.ps1'"
REM ----------------------------- End
Now create another file called "C:\Scheduled Tasks\Collect Metrics.ps1" and add this content...
#----------------------------- Start
. 'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto
. 'C:\Program Files\Microsoft\Exchange Server\V15\Scripts\CollectOverMetrics.ps1' -DatabaseAvailabilityGroup DAGDB1 -StartTime (Get-Date).AddDays(-1) -EndTime (Get-Date) -GenerateHTMLReport
$attachment = "C:\Program Files\Microsoft\Exchange Server\V15\Scripts\" + (Get-ChildItem "C:\Program Files\Microsoft\Exchange Server\V15\Scripts\*.htm" | ?{$_.lastwritetime -gt (get-date).addhours(-1)}).name
send-mailmessage -to [email protected] -from [email protected] -subject "this is a test" -smtpserver "FQDN of email server" -Attachments "$attachment"
#----------------------------- End
Now go to command prompt and go to path C:\Scheduled Tasks and run "Collect Metrics.cmd" that will show you what is going on when it is getting executed... This will help you to find what's the issue is...
Once you are able to address the issue which is coming during this run, just schedule the "C:\Scheduled Tasks\Collect Metrics.ps1" under task scheduler with the account which has proper Exchange 2013 rights and by selecting "Run weather
user is logged on or not"  and "Run with highest privileges" under that task...
Here is the output from the collect metrics.cmd:
C:\Scheduled Tasks>REM ----------------------------- Start
C:\Scheduled Tasks>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -No
nInteractive -command ". 'C:\Scheduled Tasks\Collect Metrics.ps1'"
Welcome to the Exchange Management Shell!
Full list of cmdlets: Get-Command
Only Exchange cmdlets: Get-ExCommand
Cmdlets that match a specific string: Help *<string>*
Get general help: Help
Get help for a cmdlet: Help <cmdlet name> or <cmdlet name> -?
Exchange team blog: Get-ExBlog
Show full output for a command: <command> | Format-List
Show quick reference guide: QuickRef
Tip of the day #43:
Do you have a user who has network access but maintains an external mail account outside your Exchange organization? Wit
h Exchange 2013, you can now create mail-enabled users that are regular Active Directory accounts, but also behave like
mail-enabled contacts. By using the Enable-MailUser cmdlet, you can add email contact attributes to any existing Active
Directory user who doesn't already have a mailbox on an Exchange server. Users in your Exchange organization will then b
e able to send email messages to that user's external mail account. Type:
Enable-MailUser -Identity <Active Directory Alias> -ExternalEmailAddress <Destination SMTP Address>
VERBOSE: Connecting to FQDN.mail.server.
VERBOSE: Connected to FQDN.mail.server.
Get statistics from ACTIVE Copy DB Server
Get statistics from Passive Copy DB Server
Found total of 0 entries
Generated the following per-DAG reports:
C:\Scheduled Tasks\FailoverReport.DAGDB1.2015_01_11_22_04_57.csv
Importing data from C:\Scheduled Tasks\FailoverReport.DAGDB1.2015_01_11_22_04_57.csv
Generating summary report
WriteHtmlReport : Cannot bind argument to parameter 'Data' because it is null.
At C:\Program Files\Microsoft\Exchange Server\V15\Scripts\CollectOverMetrics.ps1:1463 char:31
+ WriteHtmlReport -Data $AmOperationsData -ReportPath $HtmlSummaryReportNa ...
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [WriteHtmlReport], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,WriteHtmlReport
Summary report is C:\Scheduled Tasks\FailoverSummary.2015_01_11_22_04_57.htm
The property 'name' cannot be found on this object. Verify that the property exists.
At C:\Scheduled Tasks\Collect Metrics.ps1:7 char:2
+ $attachment = "C:\Program Files\Microsoft\Exchange Server\V15\Scripts\" + (Get- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], PropertyNotFoundException
+ FullyQualifiedErrorId : PropertyNotFoundStrict
The variable '$attachment' cannot be retrieved because it has not been set.
At C:\Scheduled Tasks\Collect Metrics.ps1:9 char:164
+ ... -Attachments "$attachment"
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (attachment:String) [], RuntimeException
+ FullyQualifiedErrorId : VariableIsUndefined
C:\Scheduled Tasks>REM ----------------------------- End
C:\Scheduled Tasks>

Similar Messages

  • Is there a way to print a Html-Report direktly in LabView?

    I created a Html-Report wich includes a jpg-Picture.
    Actually there is no way, in the Report Generation, to Print a Html file. I Would be
    glad if you have a solution (sub-vi?) to Print a Html file directly in Labview.
    Thanks
    PH!L

    You can drive IE with Lv through ActiveX: When you have creating an IE
    ActiveX reference with Lv, you will be able to open your file and then print
    them programmatically...
    "PH!L" a écrit dans le message news:
    [email protected]..
    > I created a Html-Report wich includes a jpg-Picture.
    > Actually there is no way, in the Report Generation, to Print a Html
    > file. I Would be
    > glad if you have a solution (sub-vi?) to Print a Html file directly in
    > Labview.
    > Thanks
    > PH!L

  • Create Html Report in batch

    Hi,
    can anyone tell me if i can create html report in batch ?
    how ?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Oded Raz ([email protected]):
    Hi,
    can anyone tell me if i can create html report in batch ?
    how ?<HR></BLOCKQUOTE>
    Yes....
    Discoverer supports command line scheduling that may launch Discoverer, execute a report, and automatically export this in HTML format.
    This is described in the Users Guide, under Advanced Features. (http://technet.oracle.com/docs/products/discoverer/doc_index.htm)
    This is also described in technical note #44841.1 available on Oracle's Metalink (http://metalink.oracle.com).
    The relevant command extension is:
    /export <format> <export-file>
    which Exports output with specified format (xls, html, etc) to specified output file.
    null

  • Wrong graphic at HTML-report

    Hello!
    In a first sequence I export a graphic to a HTML-report, which I close afterwards. In the second sequence I export an other graphic (generated by the same SubVI, so same size/looking (polar plot or XY-graph), but different data and other picture-variable at each sequence) to another HTML-report , but sometimes (not always) LabView 7express adds the graphic from the first report to the second one. The second picture-file (jpg) was not created then, but the link to the picture in the second HTML-report referes "technical correct" to the wrong (first) picture.
    If I export the reports twice (without changing anything), the problem disappears in most cases.
    Do you have any idea how I can solve this problem?
    Thank you!
    martin

    This sounds like a type of race condition or possibly a problem with multiple pointers to the same memory location.  Without seeing some code, it will be very hard to troubleshoot.  Could you post an example that show off this problem?
    Thanks,
    Bob Young
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

  • Print HTML Report.vi doesn't scale properly.

    LV 8.5.1, Report Generation Toolkit, XP.  Our application uses the Print HTML Report.vi to print an HTML report.
    We found that on some installations the resulting page does not scale properly.  Instead of being one page wide,
    the printout is about 1.5 pages wide (and proportionately longer), leading to our report being truncated.
    Tried different printers, different print drivers, no difference.
    Finally we noticed that the affected computers all had Internet Explorer 6 installed.  Updating to Internet
    Explorer 7 fixed the problem.  Don't know about IE8, I expect that will work as well.
    Hopefully this will help someone else who runs across this problem.  I couldn't find any reference to
    an IE > 6 dependency in the Report Generation Toolkit readme system requirement.
    Matt

    Hi Charlie,
    The layout option is not wired to anything in the Standard, HTML, Excel and Word Report, but it is used in the Quick Print default case.  The Help document for this VI mentions that the layout option is ignored on Standard and HTML Reports but does not mention the Excel or Word Reports.
    This was discovered a little while ago in this discussion forum.  And a report has be filed to R&D by Ben.
    Justin Parker
    National Instruments
    Product Support Engineer

  • Print HTML Report Automatica​lly after Each UUT

    Hello
    I saw the document on NI site called "Print HTML Report Automatically after Each UUT". That's exactly what I want to do with XML files. So I put it in my sequence file and it works fine, but when it opens the xml file at the first step, there's a pop-up from IE who say that "Scripts are generally safe, do you want to authorise this script" (This message is also displayed when I open my file in files explorer).
    So, the print is not automatically anymore as I must answer to this pop-up. does anybody has a solution to bypass this pop-up ?
    I tried to use the property silent on the class IWebBrowser2. Inded, the pop-up doesn't appear anymore, but my XML file isn't correctly printed. I supposed the default response of the pop-up (which is no) is applied. So the script isn't executed.
    I also tried to configure IE to not display this pop-up : No result
    Regards
    Laurent

    Hello,
    I think that you need to configure your browser, can you take a look a this article:
    http://www.maxi-pedia.com/scripts+are+usually+safe​+do+you+want+to+allow+scripts+to+run
    Regards,
    Nacer M. | Certified LabVIEW Architecte

  • Page break in html report

    Hi all,
    I am sending a report to external user e-mail id from SAP. The user is receiving the report in html format.
    The user asks me they need a page break on the report after each customer data. I am wondering is it possible to have a page break in html report? If yes, how it is possible?

    Hi,
    I insist : it is not possible with HTML to insert Page breaks. BUT, Tammie is right! You can use CSS (Cascade Style Sheet) to insert page breaks thanks to few lines of code in your HTML page.
    Follow this link to have a look at a very simple piece of code to illustrate this :
    http://www.codeave.com/css/code.asp?u_log=4016
    Here it the code if you don't have access to this URL :
    <html>
    <head>
    <title>CodeAve.com/CSS - Page Break</title>
    <body bgcolor="#FFFFFF">
    <center>
    Page 1
    <br style="page-break-before:always;">
    Page 2
    <br style="page-break-after:always;">
    Page 3
    <p>
    Use print preview on your browser to see how<br>
    this page would print out to three pages
    </center>
    </body>
    </html>
    Hope it helps.
    Don't forget to close the post if solved (so that search in the forum is easier), and reward points (so that SDN members are happy !) 

  • Correct URL path for images on HTML reports

    We are using Reports Server 6.0 and rwcgi60.exe to display HTML reports on the web. A number of our reports have embedded charts in them which get converted into gifs when the HTML report gets generated.
    The problem is that the HTML report has a <base href="http://machinename/cache/xyz.html"> at the top of the report. In our case, the machinename is the name of the web-server. However, when folks go to our website, they actually see our domain name rather than the internal machine name of the web-server. Hence, the images do not show up as the URL associated with the image is not accessible by folks coming from outside the web-server.
    Is there some setting that will help us set the base href associated with generated reports? Or is there some other way to get the reports to show up with images on the web?
    Thanks

    You can't change the base tag - but I'm not sure I understand the problem. If machinename.domain is the full name of the machine running the webserver, and this is what was used when calling the CGI, then this is what the base tag will have. Does your machine have 2 names or something - and only 1 gets resolved to some folks?
    Regards
    The Oracle Reports Team http://technet.oracle.com

  • Sending Email using both HTML and plain text

    I could use some advise on how to start researching email for
    both HTML and plain text messages.
    I have a script called class.phpMail.php, but the code is
    alittle advanced for me. Basically I can't get
    it to work on my server and I don't know where to begin the
    learning process here.
    I talked to my provider, "HOST" company goDaddy.com and I was
    told that to connect so that I could send email I would need this
    line of code. They didn't say it should by in my php.ini file but
    that was where I found it.
    SMTP = relay-hosting.secureserver.net
    This is the smtp address that my provider uses to make the
    connection with my mail client.
    I was told that with this line of code I would not need a
    password or username
    I did some further reseach and I found an article that stated
    that my original error:
    Warning: fsockopen() expects parameter 2 to be long, string
    given in ...../php/class.smtp.php on line 105
    was being caused by this code because the $port value needed
    to be between 1 - 65365:
    $this->smtp_conn = fsockopen($host, # the host of the server
    $port, # the port to use ----- "this is line 105"
    $errno, # error number if any
    $errstr, # error message if any
    $tval); # give up after ? secs
    In particular the $port value was coming in corrupted and
    that I needed to cast it.
    I did as they suggested and made it an (int) as they
    suggested.
    $this->smtp_conn = fsockopen($host, # the host of the server
    (int)$port, # the port to use
    $errno, # error number if any
    $errstr, # error message if any
    $tval); # give up after ? secs
    It resolved part of the error message however, the other half
    of the error message is shown below:
    Message could not be sent.
    Mailer Error: Language string failed to load: connect_host
    What exactly is the connect_host they refer to in this
    message?
    Would it be the string in my php.ini file refering to the
    SMTP = relay-hosting.secureserver.net
    I have allot of what I think are disconnected questions as I
    really have just begun to work
    with the mail() function. If anyone has the time to educate
    this newbie into the wonderful
    world of email() I would appreciate it.
    Thank You
    Kevin Raleigh

    Sorry to dig up an old post, but we've spent the last few days trying to work out why an email campaign being sent from BC is going into the Junk folder of recipients that use MS Exchange. We've fixed quite a lot of issues, including the fact that Legacy Templates have random JS injected just before they get sent, so we had to switch to the new template system. We've narrowed the issue down to one of three things:
    1. A missing alt tag on the tracking image that BC drops into the email (pretty unlikely)
    2. The BC Europe IP (54.240.14.45) is blacklisted here: UCEPROTECTL2 (possible, but if you actually look it's not the IP itself, but another IP on the same network, so unlikely)
    3. The fact that the HTML email has no text component.
    I agree, BC is late on this but I think that it needs to be added, even if most users have HTML-ready email clients, spam checkers do seem to prefer multi-MIME emails.
    This is backed up by the following SpamAssassin rule, which we are currently unable to resolve:
    -1.105
    MIME_HTML_ONLY
    Message only has text/html MIME parts
    You should also include a text version of your message (text/plain)
    So in my opinion, BC do still need to add this as a feature, otherwise the system is not viable for our customers and we'll have to look elsewhere.

  • Difference between pdf and html report format

    Why HTML report printouts truncate from the right-end side, compare to the pdf report format ?, do i need to change anything
    while running report through HTML format

    The printing from html output is majorly affected by browser settings. Once you try to change the left and right margins in page setup before printing, I solved this problem in this way , it may work for you. Let me know if it works or if you overcome it by other ways.
    with regards
    wara

  • Animated gif to html report

    Hello All
    Is it possible to save an animated GIF to a html report (for publishing to web and still maintain animation)
    Regards
    Ray

    Mike
    Firstly, thanks for showing an interest in my problem.
    I've done some searching here on the forum using keywords like html, animated gif, report etc, but haven't seen anything close to what I want to do.
    I csn save FPs as a whole into a html report, but am unsure where to even begin for an embedded item such as the gif.
    The animated gif was placed on the FP by simply cut and paste and I'm not sure how to go about saving just the gif (sans rest of the FP) to a html report and still maintain the animation properties.
    Regards
    Ray

  • Problem with NIReport.llb\Print HTML Report using IE.vi on different machines

    We have 5 machines here in our workgroup which have the same state regarding security patches and other system updates. We recently found out that there is a problem with the NIReport.llb\Print HTML Report using IE.vi on the different machines.
    If I would open the VI on MachineA the control could be loaded. If I would open the VI on MachineB the control could be loaded. If I would copy the VI from MachineB to MachineA and open the VI the control could not be loaded. If I would copy the VI from MachineA to MachineB and open the VI on MachineB the control could be loaded. MachineB could load the version from MachineA and MachineB but on MachineA only the own version will load. I have seen that both versions have the same GUID for the Microsoft Webbrowser but are different in some other aereas.
    Since printing HTML Reports is part of the application which will be distributed as application I want to know if someone else have seen such a behaviour or has got problems distributing an application.
    Also I want to know which additional information is stored in an Active-X container about the control beside the GUID.
    We have Win XP Prof SP2 with MS IE 6.0.2900.2180 on all machines in the workgroup.
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

    Hi Tom,
    this is the VI <vi.lib>\Utillitiy\NIReport.llb\Print HTML Report using IE.vi copied from a machine that can load and run the VI and it will print. On this machine the control in the VI is white.
    This VI will give the "Control could not be loaded" message on my machine.
    The file shdocvw.dll is 2006-10-23 16:18 size 1.460 KB and I verifyed that both machines have the same version of this file.
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions
    Attachments:
    Print HTML Report using IE.png ‏11 KB

  • Need a help on HTML report

    Hi,
    am going to generate an HTML report for a table by using below code
    SET heading off
    SET pagesize 80
    SET MARKUP HTML ON SPOOL ON HEAD "<TITLE>Job Comparison Report</title> -
    STYLE TYPE=’TEXT/CSS’><!--BODY {background: ffffc6} --></STYLE>"
    SET ECHO OFF
    SPOOL "C:\Jc\Reports\LoadUnmatchedCustomerHistory.htm"
    select * from TB_JOB_REPORT;
    SPOOL OFF
    SET MARKUP HTML OFF
    SET ECHO ON
    its working fine.
    but in my TB_JOB_REPORT table contains more than hundred accounts information also which is having only two fileds one is ACCT_NUM another one is TEXT_REPORT. i just want to geenrate individual report for each account as of now am getting all accounts information in a single report.
    is there any possibility to generate a report for individual accounts.
    like select * from TB_JOB_REPORT where ACCT_NUM=???, i just want to pass a loop to get corresponding account information but not sure how to implement this logic in for loop.
    any ideas to do this please share me...
    Thanks in advance

    Last week I have played with something like below (not tested!!! not very sure I remember all :( - just to get an idea ;)
    html attributes (fonts, colors, borders, ... you name it - I'm not even aware of) were filled in by others
    with
    the_data as
    (select 1 a_number,'abc' a_string,sysdate a_date from dual union all
    select 2,'qwertzuiop',trunc(sysdate) - 2 from dual union all
    select 3,'qwxy',to_date(null) from dual union all
    select 4,null,to_date('1.5.2000','dd.mm.yyyy') from dual union all
    select null,'?',trunc(sysdate) from dual
    select xmlelement("table",
             xmlagg(
               xmlelement("tr",
                 xmlelement("td",xmlattributes('right' as align), 2 * a_number),
                 xmlelement("td", initcap(a_string)),
                 xmlelement("td", to_char(a_date,'yyyy-mm-dd hh24:mi:ss'))
             order by a_number desc nulls first
                     ).getclobval()
      from the_dataRegards
    Etbin

  • Specifically controlling the width of a table in an HTML report

    I am generating an HTML report that consists of several detail tables
    followed by a summary table at the end. Each detail table is
    generated within a for loop. The summary table is generated
    separately at the end. The detail tables all have the same column
    width and same number of columns. However, I cannot get the summary
    table to have the same column width even though it has the same number
    of columns and the same column width setting.
    Does anyone have any suggestions?
    Thanks!

    Hi,
    What VI are you using to create the tables using the for loop? What VI (Append Table to Report.vi?) are you using to create the table at the end?
    If you are using the Append Table to Report.vi to create the tables in the for loop, can you change the width of the columns and see expected behavior?
    Let me know, and I should be able to help you out further.
    Travis H.
    National Instruments
    Travis H.
    LabVIEW R&D
    National Instruments

  • Open & print an existing HTML report

    I want to open a previously created, saved & closed HTML report for printing.  I don't see any thing in the Report Generation vi group for opening existing reports and wasn't sure how to go about it (if at all possible) using the standard file open options to get to a report.  Any ideas?  Thanks.

    Hello,
    To print and view an HTML report you have already saved to disk, just create a new report, and use the "Append User Formatted HTML to Report.vi" to append the entire HTML content of the report to a new report.  Then use the "Print Report.vi" and "Open HTML Report in Browser.vi" to print and view it.  This is the easiest way I can think of...here is a screenshot showing what I mean:
    Hope this helps,
    -D
    Message Edited by Darren on 04-18-2006 01:31 PM
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman
    Attachments:
    print_and_save_report.jpg ‏84 KB

Maybe you are looking for

  • Passivation of stateless session bean

    For a stateful session bean, we mention the system directory in the server xml where Server stores the state of passivated stateful session bean instances. Please can any one tell, if more than one beans are to be passivated how does it happen for on

  • After Archive and Install, music and photos lost

    Hello, I installed Leopard yesterday on my Imac desktop and it went fine, but then somehow it locked me out of the hard drive, and then...the blue screen. I put the orginal Tiger disk back in and re-installed the previous software, opting for 'archiv

  • EBP and EP6 - Including Services Other than BBPStart

    Hello All- Hopefully a quick answer to a quick question.  We are trying to integrate SRM 4.0 with EP6.0 (SP14.5).  We are having issues described in <a href="https://websmp108.sap-ag.de/~form/handler?_APP=01100107900000000342&_EVENT=REDIR&_NNUM=59551

  • Open specific tab page using button

    Hello, How can I make that one button open specific page on tab. That page was disabled and I menaged to make my program to show this page when I click one button. So next step would be that by clicking on that button this (previously disabled - unvi

  • E7 Symbian Belle Exchange ActiveSync Problem Greek...

    I recently updated my phone's SW to Symbian Belle and have the following problem. When replying  to a mail received in Greek language and although during writing (in Greek) all seems ok, after sending the mail the text is not readable (some sort of a