Dutchict
asked on
Reduce script output (need code to give count of duplicates and only view 1)
Thanks to purplepomegranite i have a script to check the eventviewer till 2 weeks ago.(thanks again for that!) Now i need to go further, i need to filter duplicates ( Example error 435 on SERVICES is placed 30 times in the eventviewer) I'd like to see only 1 but with a count of duplicates.
I have tried some stuff with if count>1, but with my noobieness i just can't figger it out.. any help?
I have tried some stuff with if count>1, but with my noobieness i just can't figger it out.. any help?
' Set earliest time for events that we want
Set objSWbemDateTime = CreateObject("WbemScripting.SWbemDateTime")
objSWbemDateTime.SetVarDate FormatDateTime(DateAdd("D",-14,Now),2), true
' The -14 specifies up to 14 days ago... change as appropriate
strHTML = strHTML & VbCrLf & "<br><br><b>Logboeken FOUTEN:</b><br>"
strComputer="."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colLoggedEvents = objWMIService.ExecQuery _
("Select * from Win32_NTLogEvent Where Logfile = 'System'" _
& " and EventType = '1' and TimeWritten>='" & objSWbemDateTime.Value & "'")
For Each objEvent in colLoggedEvents
strHTML = strHTML & VbCrLf & "<br>Event Code: " & objEvent.EventCode
strHTML = strHTML & VbCrLf & "<br>Doelbestand: " & objEvent.SourceName
strHTML = strHTML & VbCrLf & "<br>Bericht: " & objEvent.Message
strHTML = strHTML & VbCrLf & "<br>Tijd geschreven: " & objEvent.TimeWritten
strHTML = strHTML & VbCrLf & "<br>Type: " & objEvent.Type
strHTML = strHTML & VbCrLf & "<br><br>"
Next
strHTML = strHTML & VbCrLf & "<br><br><b>Logboeken WAARSCHUWINGEN:</b><br>"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colLoggedEvents = objWMIService.ExecQuery _
("Select * from Win32_NTLogEvent Where Logfile = 'System'" _
& " and EventType = '2' and TimeWritten>='" & objSWbemDateTime.Value & "'")
For Each objEvent in colLoggedEvents
strHTML = strHTML & VbCrLf & "<br>Event Code: " & objEvent.EventCode
strHTML = strHTML & VbCrLf & "<br>Doelbestand: " & objEvent.SourceName
strHTML = strHTML & VbCrLf & "<br>Bericht: " & objEvent.Message
strHTML = strHTML & VbCrLf & "<br>Tijd geschreven: " & objEvent.TimeWritten
strHTML = strHTML & VbCrLf & "<br>Type: " & objEvent.Type
strHTML = strHTML & VbCrLf & "<br><br>"
Next
wscript.echo strHTML
Open in New Window
Grade Received: A
Grading Comments:
Ah... I missed the count of duplicates... I'll modify to give a count...
This seems to work. I've modified the code so that it is more structured too. It will help if you want further modifications!!
' Set earliest time for events that we want
Set objSWbemDateTime = CreateObject("WbemScripting.SWbemDateTime")
objSWbemDateTime.SetVarDate FormatDateTime(DateAdd("D",-1,Now),2), true
' The -14 specifies up to 14 days ago... change as appropriate
strHTML = strHTML & VbCrLf & "<br><br><b>Logboeken FOUTEN:</b><br>"
strComputer="."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colLoggedEvents = objWMIService.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'System' and EventType = '1' and TimeWritten>='" & objSWbemDateTime.Value & "'")
strHTML=strHTML & ReturnEventDetails(colLoggedEvents)
strHTML = strHTML & VbCrLf & "<br><br><b>Logboeken WAARSCHUWINGEN:</b><br>"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colLoggedEvents = objWMIService.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'System' and EventType = '2' and TimeWritten>='" & objSWbemDateTime.Value & "'")
strHTML=strHTML & ReturnEventDetails(colLoggedEvents)
wscript.echo strHTML
function ReturnEventDetails(colLoggedEvents)
dim objEvent, dicDupCount, dicEventDetails, k
dim strHTML, strEventHTML
set dicDupCount=CreateObject("Scripting.Dictionary")
set dicEventDetails=CreateObject("Scripting.Dictionary")
For Each objEvent in colLoggedEvents
if not dicDupCount.Exists(objEvent.EventCode & objEvent.SourceName) then
strEventHTML = "<br>Event Code: " & objEvent.EventCode
strEventHTML = strEventHTML & VbCrLf & "<br>Doelbestand: " & objEvent.SourceName
strEventHTML = strEventHTML & VbCrLf & "<br>Bericht: " & objEvent.Message
strEventHTML = strEventHTML & VbCrLf & "<br>Tijd geschreven: " & objEvent.TimeWritten
strEventHTML = strEventHTML & VbCrLf & "<br>Type: " & objEvent.Type
dicDupCount.Add objEvent.EventCode & objEvent.SourceName, "1"
dicEventDetails.Add objEvent.EventCode & objEvent.SourceName, strEventHTML
else
intCount=dicDupCount(objEvent.EventCode & objEvent.SourceName)+1
dicDupCount(objEvent.EventCode & objEvent.SourceName)=intCount
end if
Next
' Now loop through dictionary and add to output
k=dicDupCount.Keys
for i=0 to dicDupCount.Count-1
strHTML=strHTML & dicEventDetails(k(i))
strHTML=strHTML & VbCrLf & "<br>Event count: " & dicDupCount(k(i)) & vbCrLf & "<br><br>"
next
strHTML = strHTML & VbCrLf & "<br><br><b>Logboeken WAARSCHUWINGEN:</b><br>"
ReturnEventDetails=strHTML
set dicDupCount=Nothing
set dicEventDetails=Nothing
end function
Sorry, was an extra line in the function that you don't want. Didn't notice it due to the language, lol. Attached.
' Set earliest time for events that we want
Set objSWbemDateTime = CreateObject("WbemScripting.SWbemDateTime")
objSWbemDateTime.SetVarDate FormatDateTime(DateAdd("D",-1,Now),2), true
' The -14 specifies up to 14 days ago... change as appropriate
strHTML = strHTML & VbCrLf & "<br><br><b>Logboeken FOUTEN:</b><br>"
strComputer="."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colLoggedEvents = objWMIService.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'System' and EventType = '1' and TimeWritten>='" & objSWbemDateTime.Value & "'")
strHTML=strHTML & ReturnEventDetails(colLoggedEvents)
strHTML = strHTML & VbCrLf & "<br><br><b>Logboeken WAARSCHUWINGEN:</b><br>"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colLoggedEvents = objWMIService.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'System' and EventType = '2' and TimeWritten>='" & objSWbemDateTime.Value & "'")
strHTML=strHTML & ReturnEventDetails(colLoggedEvents)
wscript.echo strHTML
function ReturnEventDetails(colLoggedEvents)
dim objEvent, dicDupCount, dicEventDetails, k
dim strHTML, strEventHTML
set dicDupCount=CreateObject("Scripting.Dictionary")
set dicEventDetails=CreateObject("Scripting.Dictionary")
For Each objEvent in colLoggedEvents
if not dicDupCount.Exists(objEvent.EventCode & objEvent.SourceName) then
strEventHTML = "<br>Event Code: " & objEvent.EventCode
strEventHTML = strEventHTML & VbCrLf & "<br>Doelbestand: " & objEvent.SourceName
strEventHTML = strEventHTML & VbCrLf & "<br>Bericht: " & objEvent.Message
strEventHTML = strEventHTML & VbCrLf & "<br>Tijd geschreven: " & objEvent.TimeWritten
strEventHTML = strEventHTML & VbCrLf & "<br>Type: " & objEvent.Type
dicDupCount.Add objEvent.EventCode & objEvent.SourceName, "1"
dicEventDetails.Add objEvent.EventCode & objEvent.SourceName, strEventHTML
else
intCount=dicDupCount(objEvent.EventCode & objEvent.SourceName)+1
dicDupCount(objEvent.EventCode & objEvent.SourceName)=intCount
end if
Next
' Now loop through dictionary and add to output
k=dicDupCount.Keys
for i=0 to dicDupCount.Count-1
strHTML=strHTML & dicEventDetails(k(i))
strHTML=strHTML & VbCrLf & "<br>Event count: " & dicDupCount(k(i)) & vbCrLf & "<br><br>"
next
ReturnEventDetails=strHTML
set dicDupCount=Nothing
set dicEventDetails=Nothing
end function
ASKER
Hi purplepomegranite, thanks again, only the last code gives a false output. Is it possible that the script can't cope with the two wmi services?
Output latest script;
-------------------------- ---------- ---------- --
Logboeken FOUTEN:
Logboeken WAARSCHUWINGEN:
Event Code: 3019
Doelbestand: MRxSmb
Bericht: De redirector kan het type van een verbinding niet vaststellen.
Tijd geschreven: 20080616142044.000000+120
Type: Waarschuwing
Event count: 4
-------------------------- ---------- -----
Output earlier script;
-------------------------- ---------- -----
Logboeken FOUTEN:
Event Code: 29
Doelbestand: W32Time
Bericht: De tijdsprovider NtpClient is geconfigureerd om de tijd uit een of meer tijdsbronnen te halen. Geen van deze bronnen zijn echter toegankelijk. Er worden geen nieuwe pogingen gedaan gedurende 15 minuten. De tijdservice heeft geen nauwkeurige tijdsbron.
Tijd geschreven: 20080605114636.000000+120
Type: Fout
Event Code: 6004
Doelbestand: EventLog
Bericht: Een besturingspakket van het IO-subsysteem is ongeldig. Raadpleeg het pakket voor meer gegevens.
Tijd geschreven: 20080612094721.000000+120
Type: Fout
Event Code: 4
Doelbestand: Kerberos
Bericht: The kerberos client received a KRB_AP_ERR_MODIFIED error from the server ROWALD$. This indicates that the password used to encrypt the kerberos service ticket is different than that on the target server. Commonly, this is due to identically named machine accounts in the target realm (DOMAIN.JMS), and the client realm. Please contact your system administrator.
Tijd geschreven: 20080612125835.000000+120
Type: Fout
Event Code: 10009
Doelbestand: DCOM
Bericht: DCOM kan met geen enkel van de protocollen die nu zijn geconfigureerd met de computer communiceren.
Tijd geschreven: 20080612145828.000000+120
Type: Fout
Event Code: 5789
Doelbestand: NETLOGON
Bericht: Poging tot bijwerken van DNS-hostnaam van het computerobject in Active Directory is mislukt. De bijgewerkte waarde is rowald.Domain.jms. De volgende fout is opgetreden: De endpointtoewijzer heeft geen endpoints meer beschikbaar. .
Tijd geschreven: 20080615060241.000000+120
Type: Fout
Event Code: 5788
Doelbestand: NETLOGON
Bericht: Poging tot bijwerken van HOST SPN's (Service Principal Names) van het computerobject in Active Directory is mislukt. De bijgewerkte waarden zijn HOST/rowald.Domain.jms en HOST/ROWALD. De volgende fout is opgetreden: De endpointtoewijzer heeft geen endpoints meer beschikbaar. .
Tijd geschreven: 20080615060241.000000+120
Type: Fout
Logboeken WAARSCHUWINGEN:
Event Code: 3019
Doelbestand: MRxSmb
Bericht: De redirector kan het type van een verbinding niet vaststellen.
Tijd geschreven: 20080610121431.000000+120
Type: Waarschuwing
Event Code: 24
Doelbestand: W32Time
Bericht: Tijdprovider/NtpClient: na 8 contactpogingen er is geen geldig antwoord ontvangen van domeincontroller jmsgs01.Domain.jms. Deze domeincontroller wordt niet meer als tijdsbron gebruikt en NtpClient probeert een nieuwe domeincontroller voor synchronisatie te vinden.
Tijd geschreven: 20080605114636.000000+120
Type: Waarschuwing
Event Code: 11197
Doelbestand: DnsApi
Bericht: Kan de A-bronrecords voor de netwerkadapter met de volgende instellingen niet bijwerken of verwijderen: Adapternaam: {45FF41CA-D548-408B-829F-0 38A1F73080 B} Hostnaam: rowald Primair domeinachtervoegsel : Domain.jms DNS-serverlijst : 10.8.1.11, 10.8.1.1, 10.8.1.2, 62.45.45.45 Update verzonden naar server : 10.1.1.1 IP-adres(sen) : 10.8.1.144 De updateaanvraag is mislukt vanwege een systeemprobleem. Raadpleeg de onderstaande recordgegevens voor de specifieke foutcode.
Tijd geschreven: 20080612091846.000000+120
Type: Waarschuwing
Event Code: 36
Doelbestand: W32Time
Bericht: De systeemtijd is gedurende 49152 seconden niet door de tijdservice gesynchroniseerd omdat geen van de tijdproviders een bruikbaar tijdstempel heeft kunnen aanbieden. De systeemklok is niet gesynchroniseerd.
Tijd geschreven: 20080615221635.000000+120
Type: Waarschuwing
-------------------------- ---------- --
Output latest script;
--------------------------
Logboeken FOUTEN:
Logboeken WAARSCHUWINGEN:
Event Code: 3019
Doelbestand: MRxSmb
Bericht: De redirector kan het type van een verbinding niet vaststellen.
Tijd geschreven: 20080616142044.000000+120
Type: Waarschuwing
Event count: 4
--------------------------
Output earlier script;
--------------------------
Logboeken FOUTEN:
Event Code: 29
Doelbestand: W32Time
Bericht: De tijdsprovider NtpClient is geconfigureerd om de tijd uit een of meer tijdsbronnen te halen. Geen van deze bronnen zijn echter toegankelijk. Er worden geen nieuwe pogingen gedaan gedurende 15 minuten. De tijdservice heeft geen nauwkeurige tijdsbron.
Tijd geschreven: 20080605114636.000000+120
Type: Fout
Event Code: 6004
Doelbestand: EventLog
Bericht: Een besturingspakket van het IO-subsysteem is ongeldig. Raadpleeg het pakket voor meer gegevens.
Tijd geschreven: 20080612094721.000000+120
Type: Fout
Event Code: 4
Doelbestand: Kerberos
Bericht: The kerberos client received a KRB_AP_ERR_MODIFIED error from the server ROWALD$. This indicates that the password used to encrypt the kerberos service ticket is different than that on the target server. Commonly, this is due to identically named machine accounts in the target realm (DOMAIN.JMS), and the client realm. Please contact your system administrator.
Tijd geschreven: 20080612125835.000000+120
Type: Fout
Event Code: 10009
Doelbestand: DCOM
Bericht: DCOM kan met geen enkel van de protocollen die nu zijn geconfigureerd met de computer communiceren.
Tijd geschreven: 20080612145828.000000+120
Type: Fout
Event Code: 5789
Doelbestand: NETLOGON
Bericht: Poging tot bijwerken van DNS-hostnaam van het computerobject in Active Directory is mislukt. De bijgewerkte waarde is rowald.Domain.jms. De volgende fout is opgetreden: De endpointtoewijzer heeft geen endpoints meer beschikbaar. .
Tijd geschreven: 20080615060241.000000+120
Type: Fout
Event Code: 5788
Doelbestand: NETLOGON
Bericht: Poging tot bijwerken van HOST SPN's (Service Principal Names) van het computerobject in Active Directory is mislukt. De bijgewerkte waarden zijn HOST/rowald.Domain.jms en HOST/ROWALD. De volgende fout is opgetreden: De endpointtoewijzer heeft geen endpoints meer beschikbaar. .
Tijd geschreven: 20080615060241.000000+120
Type: Fout
Logboeken WAARSCHUWINGEN:
Event Code: 3019
Doelbestand: MRxSmb
Bericht: De redirector kan het type van een verbinding niet vaststellen.
Tijd geschreven: 20080610121431.000000+120
Type: Waarschuwing
Event Code: 24
Doelbestand: W32Time
Bericht: Tijdprovider/NtpClient: na 8 contactpogingen er is geen geldig antwoord ontvangen van domeincontroller jmsgs01.Domain.jms. Deze domeincontroller wordt niet meer als tijdsbron gebruikt en NtpClient probeert een nieuwe domeincontroller voor synchronisatie te vinden.
Tijd geschreven: 20080605114636.000000+120
Type: Waarschuwing
Event Code: 11197
Doelbestand: DnsApi
Bericht: Kan de A-bronrecords voor de netwerkadapter met de volgende instellingen niet bijwerken of verwijderen: Adapternaam: {45FF41CA-D548-408B-829F-0
Tijd geschreven: 20080612091846.000000+120
Type: Waarschuwing
Event Code: 36
Doelbestand: W32Time
Bericht: De systeemtijd is gedurende 49152 seconden niet door de tijdservice gesynchroniseerd omdat geen van de tijdproviders een bruikbaar tijdstempel heeft kunnen aanbieden. De systeemklok is niet gesynchroniseerd.
Tijd geschreven: 20080615221635.000000+120
Type: Waarschuwing
--------------------------
Which latest script was it? Sorry, I posted a couple prematurely, so I need to know which one is producing what.
The one below works fine on my system, returning a proper count for both WMI calls. There is no problem with more than one call - but the fact they are both similar calls is why I procedurised the code.
The other point to note is that of course the event written property is only valid for the first event encountered by the routine.
The one below works fine on my system, returning a proper count for both WMI calls. There is no problem with more than one call - but the fact they are both similar calls is why I procedurised the code.
The other point to note is that of course the event written property is only valid for the first event encountered by the routine.
' Set earliest time for events that we want
Set objSWbemDateTime = CreateObject("WbemScripting.SWbemDateTime")
objSWbemDateTime.SetVarDate FormatDateTime(DateAdd("D",-14,Now),2), true
' The -14 specifies up to 14 days ago... change as appropriate
strHTML = strHTML & VbCrLf & "<br><br><b>Logboeken FOUTEN:</b><br>"
strComputer="."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colLoggedEvents = objWMIService.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'System' and EventType = '1' and TimeWritten>='" & objSWbemDateTime.Value & "'")
strHTML=strHTML & ReturnEventDetails(colLoggedEvents)
strHTML = strHTML & VbCrLf & "<br><br><b>Logboeken WAARSCHUWINGEN:</b><br>"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colLoggedEvents = objWMIService.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'System' and EventType = '2' and TimeWritten>='" & objSWbemDateTime.Value & "'")
strHTML=strHTML & ReturnEventDetails(colLoggedEvents)
wscript.echo strHTML
function ReturnEventDetails(colLoggedEvents)
dim objEvent, dicDupCount, dicEventDetails, k
dim strHTML, strEventHTML
set dicDupCount=CreateObject("Scripting.Dictionary")
set dicEventDetails=CreateObject("Scripting.Dictionary")
For Each objEvent in colLoggedEvents
if not dicDupCount.Exists(objEvent.EventCode & objEvent.SourceName) then
strEventHTML = vbCrLf & "<br>Event Code: " & objEvent.EventCode
strEventHTML = strEventHTML & VbCrLf & "<br>Doelbestand: " & objEvent.SourceName
strEventHTML = strEventHTML & VbCrLf & "<br>Bericht: " & objEvent.Message
strEventHTML = strEventHTML & "<br>Tijd geschreven: " & objEvent.TimeWritten
strEventHTML = strEventHTML & VbCrLf & "<br>Type: " & objEvent.Type
dicDupCount.Add objEvent.EventCode & objEvent.SourceName, "1"
dicEventDetails.Add objEvent.EventCode & objEvent.SourceName, strEventHTML
else
intCount=dicDupCount(objEvent.EventCode & objEvent.SourceName)+1
dicDupCount(objEvent.EventCode & objEvent.SourceName)=intCount
end if
Next
' Now loop through dictionary and add to output
k=dicDupCount.Keys
for i=0 to dicDupCount.Count-1
strHTML=strHTML & dicEventDetails(k(i))
strHTML=strHTML & VbCrLf & "<br>Event count: " & dicDupCount(k(i)) & vbCrLf & "<br><br>" & vbCrLf & vbCrLf
next
ReturnEventDetails=strHTML
set dicDupCount=Nothing
set dicEventDetails=Nothing
end function
And actually, just to completely overload this thread with code examples (sorry!!), the attached will save the output as an HTML file. This makes it much easier to read, and also you don't lose a lot of the output, which you do if run in a command window.
It creates a file called output.htm in it's current directory. Note it isn't complete HTML, but browsers should handle it ok anyway.
It creates a file called output.htm in it's current directory. Note it isn't complete HTML, but browsers should handle it ok anyway.
' Set earliest time for events that we want
Set objSWbemDateTime = CreateObject("WbemScripting.SWbemDateTime")
objSWbemDateTime.SetVarDate FormatDateTime(DateAdd("D",-14,Now),2), true
' The -14 specifies up to 14 days ago... change as appropriate
strHTML = strHTML & VbCrLf & "<br><br><b>Logboeken FOUTEN:</b><br>"
strComputer="."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colLoggedEvents = objWMIService.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'System' and EventType = '1' and TimeWritten>='" & objSWbemDateTime.Value & "'")
strHTML=strHTML & ReturnEventDetails(colLoggedEvents)
strHTML = strHTML & VbCrLf & "<br><br><b>Logboeken WAARSCHUWINGEN:</b><br>"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colLoggedEvents = objWMIService.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'System' and EventType = '2' and TimeWritten>='" & objSWbemDateTime.Value & "'")
strHTML=strHTML & ReturnEventDetails(colLoggedEvents)
dim objFSO
set objFSO=CreateObject("Scripting.FileSystemObject")
set objF=objFSO.CreateTextFile("output.htm",true)
objF.Write strHTML
objF.Close
set objF=Nothing
set objFSO=Nothing
wscript.echo strHTML
function ReturnEventDetails(colLoggedEvents)
dim objEvent, dicDupCount, dicEventDetails, k
dim strHTML, strEventHTML
set dicDupCount=CreateObject("Scripting.Dictionary")
set dicEventDetails=CreateObject("Scripting.Dictionary")
For Each objEvent in colLoggedEvents
if not dicDupCount.Exists(objEvent.EventCode & objEvent.SourceName) then
strEventHTML = vbCrLf & "<br>Event Code: " & objEvent.EventCode
strEventHTML = strEventHTML & VbCrLf & "<br>Doelbestand: " & objEvent.SourceName
strEventHTML = strEventHTML & VbCrLf & "<br>Bericht: " & objEvent.Message
strEventHTML = strEventHTML & "<br>Tijd geschreven: " & objEvent.TimeWritten
strEventHTML = strEventHTML & VbCrLf & "<br>Type: " & objEvent.Type
dicDupCount.Add objEvent.EventCode & objEvent.SourceName, "1"
dicEventDetails.Add objEvent.EventCode & objEvent.SourceName, strEventHTML
else
intCount=dicDupCount(objEvent.EventCode & objEvent.SourceName)+1
dicDupCount(objEvent.EventCode & objEvent.SourceName)=intCount
end if
Next
' Now loop through dictionary and add to output
k=dicDupCount.Keys
for i=0 to dicDupCount.Count-1
strHTML=strHTML & dicEventDetails(k(i))
strHTML=strHTML & VbCrLf & "<br>Event count: " & dicDupCount(k(i)) & vbCrLf & "<br><br>" & vbCrLf & vbCrLf
next
ReturnEventDetails=strHTML
set dicDupCount=Nothing
set dicEventDetails=Nothing
end function
It must be said, I should thank you for getting me involved in this code. I need some script to monitor remote servers and send me an email with pertinent information - some of which is obviously the event log. So this script is perfect as a basis for that - and I probably wouldn't have got around to it as quickly had you not asked the question!!
ASKER
I am creating a script to view the most wanted data of a computer/server to check periodicly. The thing my script is getting frusted about is the wscript.echo strHTML. I will atach the full code here...
--------------
sorry for this long script, but it's what we want..lol
Please see you'r script active within this script, what can i do to replace the wscript.echo strhtml?
code.txt
--------------
sorry for this long script, but it's what we want..lol
Please see you'r script active within this script, what can i do to replace the wscript.echo strhtml?
code.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
wow, that's the thing we needed! Thanks for your help (again!), next chalenge will be to check windows update and give a feedback to the html with the available updates..
ASKER
That's why you called a master here!
Glad that part's done!
Incidentally, if you need further help developing this particular script, you can use the Ask a Related Question link at the bottom of this thread. This will put a new question up, but means I receive an email to say that a related question has been asked. This isn't to say that other experts can't or won't answer (they will see it as usual), it's just useful for follow-on questions where you have been helped already.
Incidentally, if you need further help developing this particular script, you can use the Ask a Related Question link at the bottom of this thread. This will put a new question up, but means I receive an email to say that a related question has been asked. This isn't to say that other experts can't or won't answer (they will see it as usual), it's just useful for follow-on questions where you have been helped already.
ASKER
purplepomegranite, i have already opened a new question, i have found a script to check windows update for updates and drivers. Only to get this work within the script... I also am bussy with a virusscan check on multiple antivirus software platforms, that will be the next question..lol
I hope you'll also like the script, when it is finished it will autocheck a server and place all results in a html file. That file can then be used to place on our customer lounge, so customers can view there reports and can see the actions we made in our logsystem. It will be a lot of code and take up to 3 minutes to run when finished but take a lot of work out of hands.
If you want i can place the final script (at the end of the run) here. There is a lot of 'face lifts" done to the output file, and there is a "wait till script ends" screen when running. Englisg translation will be available to.
I hope you'll also like the script, when it is finished it will autocheck a server and place all results in a html file. That file can then be used to place on our customer lounge, so customers can view there reports and can see the actions we made in our logsystem. It will be a lot of code and take up to 3 minutes to run when finished but take a lot of work out of hands.
If you want i can place the final script (at the end of the run) here. There is a lot of 'face lifts" done to the output file, and there is a "wait till script ends" screen when running. Englisg translation will be available to.
The attached has been modified to suppress duplicate events (a duplicate being defined as the same event number from the same event source).
Open in new window