![]() |
![]() |
|
|||||||
| Register | Forum Rules | Getting Started! - Guide | Blog | Videos | Gallery | Members List | Social Groups | Mark Forums Read |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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@discussions.microsoft.com> дϢ:ED7726DB-D23B-4698-9AB9-568967A227F5@microsoft.com... >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 |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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@discussions.microsoft.com> дÈëÏûÏ¢ÐÂÎÅ:ED7726DB-D23B-4698-9AB9-568967A227F5@microsoft.com... > >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 > > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
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@discussions.microsoft.com> дϢ:C6C12B2C-65BE-4068-AE65-0BF101D44656@microsoft.com... > 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@discussions.microsoft.com> D䨨????D???:ED7726DB-D23B-4698-9AB9-568967A227F5@microsoft.com... >> >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 >> >> >> |
|
|
|
#5 |
|
Guest
Posts: n/a
|
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@discussions.microsoft.com> дÈëÏûÏ¢ÐÂÎÅ:C6C12B2C-65BE-4068-AE65-0BF101D44656@microsoft.com... > > 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@discussions.microsoft.com> D¡ä¨¨????¡éD???:ED7726DB-D23B-4698-9AB9-568967A227F5@microsoft.com... > >> >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 > >> > >> > >> > > > |
|
|
|
#6 |
|
Guest
Posts: n/a
|
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. |
|
|
|
#7 |
|
Guest
Posts: n/a
|
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@discussions.microsoft.com> дÈëÏûÏ¢ÐÂÎÅ:C6C12B2C-65BE-4068-AE65-0BF101D44656@microsoft.com... > > > 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@discussions.microsoft.com> D¡ä¨¨????¡éD???:ED7726DB-D23B-4698-9AB9-568967A227F5@microsoft.com... > > >> >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 > > >> > > >> > > >> > > > > > > |
|
|
|
#8 |
|
Guest
Posts: n/a
|
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@discussions.microsoft.com> >>> дÈëÏûÏ¢ÐÂÎÅ:C6C12B2C-65BE-4068-AE65-0BF101D44656@microsoft.com... >>> >>>> 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@discussions.microsoft.com> >>>>> D¡ä¨¨????¡éD???:ED7726DB-D23B-4698-9AB9-568967A227F5@microsoft.com >>>>> ... >>>>> >>>>>> 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 >>>>>> |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
< Home - Windows Help - MS Office Help - Hardware Support >
| New To Site? | Need Help? |