Windows Vista Forums

Making html tables

  1. #1


    Arda Guest

    Making html tables

    I need to generate a html table associated with the error events that is
    recorded in the events log. I need to make 2 columns; first the app name and
    the second number of errors. I use the following code, but get more entries
    than i need. Also how do i go about putting colours on the headings and make
    it a neater table. $a=Get-EventLog application | select entrytype,source |
    where {$_.entrytype -eq "Error"} | Group-Object source | convertto-html $a >
    error.html

    Cheers

      My System SpecsSystem Spec

  2. #2


    Tao Ma Guest

    Re: Making html tables

    Hi Arda,

    Try:
    Get-EventLog application -EntryType Error | Sort-Object Source |
    Group-Object Source | ConvertTo-Html Name, Count > a.html

    Tao Ma

    "Arda" <Arda@xxxxxx> дϢ:ED7726DB-D23B-4698-9AB9-568967A227F5@xxxxxx

    >I need to generate a html table associated with the error events that is
    > recorded in the events log. I need to make 2 columns; first the app name
    > and
    > the second number of errors. I use the following code, but get more
    > entries
    > than i need. Also how do i go about putting colours on the headings and
    > make
    > it a neater table. $a=Get-EventLog application | select entrytype,source
    > |
    > where {$_.entrytype -eq "Error"} | Group-Object source | convertto-html
    > $a >
    > error.html
    >
    > Cheers


      My System SpecsSystem Spec

  3. #3


    Arda Guest

    Re: Making html tables

    Thank you for the quick reply Tao Ma
    I tried it but, got an error about a parameter not being found how ever i
    edited your code slightly and got it to work. How would i go about putting in
    some color any ideas?
    This is the code i used:
    Get-EventLog application |select entrytype, source | Sort-Object error |
    where {$_.entrytype -eq "Error"} |
    Group-Object Source | ConvertTo-Html Name, Count > a.html


    "Tao Ma" wrote:

    > Hi Arda,
    >
    > Try:
    > Get-EventLog application -EntryType Error | Sort-Object Source |
    > Group-Object Source | ConvertTo-Html Name, Count > a.html
    >
    > Tao Ma
    >
    > "Arda" <Arda@xxxxxx> дÈëÏûÏ¢ÐÂÎÅ:ED7726DB-D23B-4698-9AB9-568967A227F5@xxxxxx

    > >I need to generate a html table associated with the error events that is
    > > recorded in the events log. I need to make 2 columns; first the app name
    > > and
    > > the second number of errors. I use the following code, but get more
    > > entries
    > > than i need. Also how do i go about putting colours on the headings and
    > > make
    > > it a neater table. $a=Get-EventLog application | select entrytype,source
    > > |
    > > where {$_.entrytype -eq "Error"} | Group-Object source | convertto-html
    > > $a >
    > > error.html
    > >
    > > Cheers
    >
    >
    >

      My System SpecsSystem Spec

  4. #4


    Tao Ma Guest

    Re: Making html tables

    Hi Arda,

    I can use regular expression to insert some attributes into html tags. But
    it is ugly...Others may give some good ideas later.

    Sorry I totally forgot that I am using PowerShell V2 CTP2. So I can use
    'EntryType' parameter in my previous code. I modify my code, you can try:
    Get-EventLog application | ? { $_.EntryType -eq 'Error' } | Sort-Object
    Source | Group-Object Source | ConvertTo-Html Name, Count

    I think my code is faster than yours.

    Tao Ma

    "Arda" <Arda@xxxxxx> дϢ:C6C12B2C-65BE-4068-AE65-0BF101D44656@xxxxxx

    > Thank you for the quick reply Tao Ma
    > I tried it but, got an error about a parameter not being found how ever i
    > edited your code slightly and got it to work. How would i go about putting
    > in
    > some color any ideas?
    > This is the code i used:
    > Get-EventLog application |select entrytype, source | Sort-Object error |
    > where {$_.entrytype -eq "Error"} |
    > Group-Object Source | ConvertTo-Html Name, Count > a.html
    >
    >
    > "Tao Ma" wrote:
    >

    >> Hi Arda,
    >>
    >> Try:
    >> Get-EventLog application -EntryType Error | Sort-Object Source |
    >> Group-Object Source | ConvertTo-Html Name, Count > a.html
    >>
    >> Tao Ma
    >>
    >> "Arda" <Arda@xxxxxx> D䨨????D???:ED7726DB-D23B-4698-9AB9-568967A227F5@xxxxxx

    >> >I need to generate a html table associated with the error events that is
    >> > recorded in the events log. I need to make 2 columns; first the app
    >> > name
    >> > and
    >> > the second number of errors. I use the following code, but get more
    >> > entries
    >> > than i need. Also how do i go about putting colours on the headings and
    >> > make
    >> > it a neater table. $a=Get-EventLog application | select
    >> > entrytype,source
    >> > |
    >> > where {$_.entrytype -eq "Error"} | Group-Object source | convertto-html
    >> > $a >
    >> > error.html
    >> >
    >> > Cheers
    >>
    >>
    >>


      My System SpecsSystem Spec

  5. #5


    Tristan Guest

    Re: Making html tables

    Hi,

    Here is a link to tag insertion such as Tao Ma refered to below:
    http://www.microsoft.com/technet/scr...pstip0104.mspx

    Regards,
    Tristan

    "Tao Ma" wrote:

    > Hi Arda,
    >
    > I can use regular expression to insert some attributes into html tags. But
    > it is ugly...Others may give some good ideas later.
    >
    > Sorry I totally forgot that I am using PowerShell V2 CTP2. So I can use
    > 'EntryType' parameter in my previous code. I modify my code, you can try:
    > Get-EventLog application | ? { $_.EntryType -eq 'Error' } | Sort-Object
    > Source | Group-Object Source | ConvertTo-Html Name, Count
    >
    > I think my code is faster than yours.
    >
    > Tao Ma
    >
    > "Arda" <Arda@xxxxxx> дÈëÏûÏ¢ÐÂÎÅ:C6C12B2C-65BE-4068-AE65-0BF101D44656@xxxxxx

    > > Thank you for the quick reply Tao Ma
    > > I tried it but, got an error about a parameter not being found how ever i
    > > edited your code slightly and got it to work. How would i go about putting
    > > in
    > > some color any ideas?
    > > This is the code i used:
    > > Get-EventLog application |select entrytype, source | Sort-Object error |
    > > where {$_.entrytype -eq "Error"} |
    > > Group-Object Source | ConvertTo-Html Name, Count > a.html
    > >
    > >
    > > "Tao Ma" wrote:
    > >

    > >> Hi Arda,
    > >>
    > >> Try:
    > >> Get-EventLog application -EntryType Error | Sort-Object Source |
    > >> Group-Object Source | ConvertTo-Html Name, Count > a.html
    > >>
    > >> Tao Ma
    > >>
    > >> "Arda" <Arda@xxxxxx> D¡ä¨¨????¡éD???:ED7726DB-D23B-4698-9AB9-568967A227F5@xxxxxx
    > >> >I need to generate a html table associated with the error events that is
    > >> > recorded in the events log. I need to make 2 columns; first the app
    > >> > name
    > >> > and
    > >> > the second number of errors. I use the following code, but get more
    > >> > entries
    > >> > than i need. Also how do i go about putting colours on the headings and
    > >> > make
    > >> > it a neater table. $a=Get-EventLog application | select
    > >> > entrytype,source
    > >> > |
    > >> > where {$_.entrytype -eq "Error"} | Group-Object source | convertto-html
    > >> > $a >
    > >> > error.html
    > >> >
    > >> > Cheers
    > >>
    > >>
    > >>
    >
    >
    >

      My System SpecsSystem Spec

  6. #6


    Flowering Weeds Guest

    Re: Making html tables


    > How would i go about
    > putting in
    > some color any ideas?

    > This is the code i used:
    > Get-EventLog application
    The Windows data parser,
    Log Parser, 2.2 will also
    do all this (in any Windows
    language or Windows tool -
    like the Windows automation
    tool - Windows PowerShell)!

    Start with this information:

    PS> LogParser.exe -h -i:evt

    Input format: EVT (Windows Event Log)
    Parses the Windows Event Log

    And

    PS> LogParser.exe -h -o:tpl

    Output format: TPL (FileTemplate Output Format)
    Formats the output following a user-specified template

    With the TPL (FileTemplate Output Format)
    one can use any html element or whatever
    type of file template output format that one
    wants to define and use.

    Remember, with Log Parser one can
    send the output to files, a SQL table
    within a SQL data base, a data grid or
    even chart the output or to where ever
    (when one "creates" a newer output way)!

    Notice: IIS does not need to be running
    or installed in order to use Log Parser
    for either data parsing or chart making.

    Search the Internet
    (and this newsgroup)
    for usage of:

    Microsoft's Log Parser
    command line usage,
    or fully script enabled
    either in COM or .NET
    (from the IIS group)

    Just one of many examples of the
    automation tool, PowerShell automating
    the Windows data parsing tool, Log
    Parser.



      My System SpecsSystem Spec

  7. #7


    Arda Guest

    Re: Making html tables

    Thanks Tristan, now that i have color I'm back at square one. The only code
    that kind of works is this $a = "<style>"
    $a = $a + "TABLE{border-width: 0px;border-style: solid;border-color:
    black;border-collapse: collapse;}"
    $a = $a + "TH{border-width: 0px;padding: 0px;border-style:
    solid;border-color: black;background-color:Blue:}"
    $a = $a + "TD{border-width: 0px;padding: 0px;border-style:
    solid;border-color: black;background-color:White}"
    $a = $a + "</style>"

    Get-EventLog application |select entrytype, source | Sort-Object error |
    where {$_.entrytype -eq "Error"} |
    Group-Object Source | ConvertTo-Html -head $a -Body "Error List" | Out-File
    a.html

    I just need to get rid of Values and Group, and just have Name and Count on
    my html page. Ive been at it for hours and its realy bugging me lol if anyone
    can help that will be awesome. Thanks for all the contribution so far, really
    appriciate it.
    Cheers guys

    "Tristan" wrote:

    > Hi,
    >
    > Here is a link to tag insertion such as Tao Ma refered to below:
    > http://www.microsoft.com/technet/scr...pstip0104.mspx
    >
    > Regards,
    > Tristan
    >
    > "Tao Ma" wrote:
    >

    > > Hi Arda,
    > >
    > > I can use regular expression to insert some attributes into html tags. But
    > > it is ugly...Others may give some good ideas later.
    > >
    > > Sorry I totally forgot that I am using PowerShell V2 CTP2. So I can use
    > > 'EntryType' parameter in my previous code. I modify my code, you can try:
    > > Get-EventLog application | ? { $_.EntryType -eq 'Error' } | Sort-Object
    > > Source | Group-Object Source | ConvertTo-Html Name, Count
    > >
    > > I think my code is faster than yours.
    > >
    > > Tao Ma
    > >
    > > "Arda" <Arda@xxxxxx> дÈëÏûÏ¢ÐÂÎÅ:C6C12B2C-65BE-4068-AE65-0BF101D44656@xxxxxx

    > > > Thank you for the quick reply Tao Ma
    > > > I tried it but, got an error about a parameter not being found how ever i
    > > > edited your code slightly and got it to work. How would i go about putting
    > > > in
    > > > some color any ideas?
    > > > This is the code i used:
    > > > Get-EventLog application |select entrytype, source | Sort-Object error |
    > > > where {$_.entrytype -eq "Error"} |
    > > > Group-Object Source | ConvertTo-Html Name, Count > a.html
    > > >
    > > >
    > > > "Tao Ma" wrote:
    > > >
    > > >> Hi Arda,
    > > >>
    > > >> Try:
    > > >> Get-EventLog application -EntryType Error | Sort-Object Source |
    > > >> Group-Object Source | ConvertTo-Html Name, Count > a.html
    > > >>
    > > >> Tao Ma
    > > >>
    > > >> "Arda" <Arda@xxxxxx> D¡ä¨¨????¡éD???:ED7726DB-D23B-4698-9AB9-568967A227F5@xxxxxx
    > > >> >I need to generate a html table associated with the error events that is
    > > >> > recorded in the events log. I need to make 2 columns; first the app
    > > >> > name
    > > >> > and
    > > >> > the second number of errors. I use the following code, but get more
    > > >> > entries
    > > >> > than i need. Also how do i go about putting colours on the headings and
    > > >> > make
    > > >> > it a neater table. $a=Get-EventLog application | select
    > > >> > entrytype,source
    > > >> > |
    > > >> > where {$_.entrytype -eq "Error"} | Group-Object source | convertto-html
    > > >> > $a >
    > > >> > error.html
    > > >> >
    > > >> > Cheers
    > > >>
    > > >>
    > > >>
    > >
    > >
    > >

      My System SpecsSystem Spec

  8. #8


    Shay Levi Guest

    Re: Making html tables



    Here's another option:

    $head= @"
    <script language="JavaScript">
    window.onload=function(){
    var TRs = document.getElementsByTagName("TR");
    for (i=1; i <= TRs.length ; i++){
    if (i % 2 == 1){
    TRs[i].style.backgroundColor = "lightblue";
    } else {
    TRs[i].style.backgroundColor = "yellow";
    }
    }
    }
    </script>

    <style>
    BODY{background-color:white;}
    TABLE{border-width: 3px;border-style: solid; border-color:white;border-collapse:
    collapse;}
    TH{border-width: 3px;padding: 2px;border-style: solid;border-color: white;background-color:yellow}
    </style>
    "@


    Get-EventLog application | where {$_.entrytype -eq "Error"} | group Source
    -NoElement | select name,count | sort count -desc | convertto-html -head
    $head -body "<H2>Error List</H2>" | Out-File a.html




    ---
    Shay Levi
    $cript Fanatic
    http://scriptolog.blogspot.com

    > Thanks Tristan, now that i have color I'm back at square one. The only
    > code
    > that kind of works is this $a = "<style>"
    > $a = $a + "TABLE{border-width: 0px;border-style: solid;border-color:
    > black;border-collapse: collapse;}"
    > $a = $a + "TH{border-width: 0px;padding: 0px;border-style:
    > solid;border-color: black;background-color:Blue:}"
    > $a = $a + "TD{border-width: 0px;padding: 0px;border-style:
    > solid;border-color: black;background-color:White}"
    > $a = $a + "</style>"
    > Get-EventLog application |select entrytype, source | Sort-Object
    > error |
    > where {$_.entrytype -eq "Error"} |
    > Group-Object Source | ConvertTo-Html -head $a -Body "Error List" |
    > Out-File
    > a.html
    > I just need to get rid of Values and Group, and just have Name and
    > Count on
    > my html page. Ive been at it for hours and its realy bugging me lol if
    > anyone
    > can help that will be awesome. Thanks for all the contribution so far,
    > really
    > appriciate it.
    > Cheers guys
    > "Tristan" wrote:
    >

    >> Hi,
    >>
    >> Here is a link to tag insertion such as Tao Ma refered to below:
    >> http://www.microsoft.com/technet/scr.../pstips/jan08/
    >> pstip0104.mspx
    >>
    >> Regards,
    >> Tristan
    >> "Tao Ma" wrote:
    >>

    >>> Hi Arda,
    >>>
    >>> I can use regular expression to insert some attributes into html
    >>> tags. But it is ugly...Others may give some good ideas later.
    >>>
    >>> Sorry I totally forgot that I am using PowerShell V2 CTP2. So I can
    >>> use 'EntryType' parameter in my previous code. I modify my code, you
    >>> can try: Get-EventLog application | ? { $_.EntryType -eq 'Error' } |
    >>> Sort-Object Source | Group-Object Source | ConvertTo-Html Name,
    >>> Count
    >>>
    >>> I think my code is faster than yours.
    >>>
    >>> Tao Ma
    >>>
    >>> "Arda" <Arda@xxxxxx>
    >>> дÈëÏûÏ¢ÐÂÎÅ:C6C12B2C-65BE-4068-AE65-0BF101D44656@xxxxxx
    >>>
    >>>> Thank you for the quick reply Tao Ma
    >>>> I tried it but, got an error about a parameter not being found how
    >>>> ever i
    >>>> edited your code slightly and got it to work. How would i go about
    >>>> putting
    >>>> in
    >>>> some color any ideas?
    >>>> This is the code i used:
    >>>> Get-EventLog application |select entrytype, source | Sort-Object
    >>>> error |
    >>>> where {$_.entrytype -eq "Error"} |
    >>>> Group-Object Source | ConvertTo-Html Name, Count > a.html
    >>>> "Tao Ma" wrote:
    >>>>
    >>>>> Hi Arda,
    >>>>>
    >>>>> Try:
    >>>>> Get-EventLog application -EntryType Error | Sort-Object Source |
    >>>>> Group-Object Source | ConvertTo-Html Name, Count > a.html
    >>>>> Tao Ma
    >>>>>
    >>>>> "Arda" <Arda@xxxxxx>
    >>>>> D¡ä¨¨????¡éD???:ED7726DB-D23B-4698-9AB9-568967A227F5@xxxxxx
    >>>>> ...
    >>>>>
    >>>>>> I need to generate a html table associated with the error events
    >>>>>> that is
    >>>>>> recorded in the events log. I need to make 2 columns; first the
    >>>>>> app
    >>>>>> name
    >>>>>> and
    >>>>>> the second number of errors. I use the following code, but get
    >>>>>> more
    >>>>>> entries
    >>>>>> than i need. Also how do i go about putting colours on the
    >>>>>> headings and
    >>>>>> make
    >>>>>> it a neater table. $a=Get-EventLog application | select
    >>>>>> entrytype,source
    >>>>>> |
    >>>>>> where {$_.entrytype -eq "Error"} | Group-Object source |
    >>>>>> convertto-html
    >>>>>> $a >
    >>>>>> error.html
    >>>>>> Cheers
    >>>>>>


      My System SpecsSystem Spec


Making html tables
Similar Threads
Thread Forum
Using Tables within emails Vista mail
working on html objects using HTML DOM, VBscript VB Script
Multiple tables .NET General
tables in wlm Live Mail
Hash Tables PowerShell