Hello,

I have a script for backing up and clearing log files. I was
wondering... is there any way (WQL perhaps) to get the names of the
event logs. In the domain, there are domain controllers and member
servers. The domain controllers have 6 physical logs and the member
servers have 3 physical logs. It would be cool to create a collection
which holds all the event view logs on the host automatically --
instead of hardcoding event log names or maintaining two different
scripts where the only difference is the number of *.evt files.

I tried looking at some of the very verbose scriptomatic stuff but
didn't see a method to get all the event log names off of a host.

Suggestions are greatly appreciated!

Re: get event log NAMES by Jeremy

Jeremy
Mon Jun 11 15:55:23 CDT 2007

Just enumerate the subkeys under HKLM\CurrentControlSet\Services\EventLog
for the names.

Cheers,
Jeremy.

"Adam Sandler" <corn29@excite.com> wrote in message
news:1181594444.518104.231010@h2g2000hsg.googlegroups.com...
> Hello,
>
> I have a script for backing up and clearing log files. I was
> wondering... is there any way (WQL perhaps) to get the names of the
> event logs. In the domain, there are domain controllers and member
> servers. The domain controllers have 6 physical logs and the member
> servers have 3 physical logs. It would be cool to create a collection
> which holds all the event view logs on the host automatically --
> instead of hardcoding event log names or maintaining two different
> scripts where the only difference is the number of *.evt files.
>
> I tried looking at some of the very verbose scriptomatic stuff but
> didn't see a method to get all the event log names off of a host.
>
> Suggestions are greatly appreciated!
>


Re: get event log NAMES by Adam

Adam
Tue Jun 12 08:25:56 CDT 2007

On Jun 11, 2:55 pm, "Jeremy" <jer...@discussions.microsoft.com> wrote:
> Just enumerate the subkeys under HKLM\CurrentControlSet\Services\EventLog
> for the names.
>
> Cheers,
> Jeremy.

Thanks!


Re: get event log NAMES by urkec

urkec
Tue Jun 12 10:03:00 CDT 2007

"Adam Sandler" wrote:

> On Jun 11, 2:55 pm, "Jeremy" <jer...@discussions.microsoft.com> wrote:
> > Just enumerate the subkeys under HKLM\CurrentControlSet\Services\EventLog
> > for the names.
> >
> > Cheers,
> > Jeremy.
>
> Thanks!
>
>

Or this:

strComputer = "."
Set objSWbemServices = GetObject("winmgmts:\\" _
& strComputer & "\root\cimv2")

Set colSWbemObjectSet = objSWbemServices.ExecQuery _
("SELECT * FROM Win32_NTEventlogFile")

For Each objSWbemObject In colSWbemObjectSet
Wscript.Echo "Log name: " _
& objSWbemObject.LogfileName
Next


--
urkec