Can I write to the Applications Log from the command line?

T

ToddAndMargo

Hi All,

Can I write to the Applications Log from the command
line (batch file)?

Many thanks,
-T
 
T

ToddAndMargo

Tim said:
Yes, download the command-line tool: logevent.exe from:

http://www.dynawell.com/download/ResKit/Microsoft/WinNT/logevent.zip

...you can then use this from a batchfile.


Usage: Z:\home\CDs\Windows\FileSystem\LogEvent\LogEvent.exe [-m
\\MACHINENAME] [-s SIWEF] [-c CategoryNumber] "Event Text"
Severity is one of (S)uccess, (I)nformation, (W)arning, (E)rror or
(F)ailure.

Which one of these writes to the "Applications" log?

LogEvent -m \\%machinename% -s S -c ????? "backup successful"

Me thinks it is the "CatagoryNumber", as I have no idea what
that is.

-T
 
T

Tim Meddick

If you just want an event in the 'Applications' section, then have the
command:

logevent.exe "Successfully Backed up at: %TIME%"

Will produce a USER EVENT in APPLICATION LOG with the information:

Successfully Backed up at: 21:45:54.89

.....appended to it in the description section of the events 'properties'
(the time here is just an example: by putting the call for the variable
%TIME% in the command-line the current time will be appended to the output)

--

Cheers, Tim Meddick, Peckham, London.


ToddAndMargo said:
Tim said:
Yes, download the command-line tool: logevent.exe from:

http://www.dynawell.com/download/ResKit/Microsoft/WinNT/logevent.zip

...you can then use this from a batchfile.


Usage: Z:\home\CDs\Windows\FileSystem\LogEvent\LogEvent.exe [-m
\\MACHINENAME] [-s SIWEF] [-c CategoryNumber] "Event Text"
Severity is one of (S)uccess, (I)nformation, (W)arning, (E)rror or
(F)ailure.

Which one of these writes to the "Applications" log?

LogEvent -m \\%machinename% -s S -c ????? "backup successful"

Me thinks it is the "CatagoryNumber", as I have no idea what
that is.

-T
 
T

ToddAndMargo

Tim said:
If you just want an event in the 'Applications' section, then have the
command:

logevent.exe "Successfully Backed up at: %TIME%"

Will produce a USER EVENT in APPLICATION LOG with the information:

Successfully Backed up at: 21:45:54.89

....appended to it in the description section of the events 'properties'
(the time here is just an example: by putting the call for the variable
%TIME% in the command-line the current time will be appended to the output)

Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top