Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Apr 2002
    Location
    Texas, USA
    Posts
    208
    Thanks
    0
    Thanked 1 Time in 1 Post

    How to - Write to Windows Event Log with a script

    How To - Write to the Windows Event Log via Script at the startup of Windows.

    This is basically a 2 part issue/question that I have researched sevral times, spending hours on it each time I researched it. After the first try I gave up on trying to get a single answer at once and broke this down into 2 items:

    1) How to write to the Windows Event Log via script
    2) How to call a script automatically at the startup of windows (also would like to know how to call script at shutdown of Windows).

    Even broken down like this it's been a nightmare of unbelievable proportions to get an answer especially to writing to the Windows Event Log via script. I've seen plenty of Google links for doing this via '.Net' but that's over kill. Plus I need a script method so that I can have the code easily execute at the start & shutdown fo Windows.

    I know in one of my past sessions I found a place in Windows XP where you could specify the name of a script to execute when Windows Starts/Shutsdown but I neglected to bookmark it and now I don't recall the answer.

    I'm trying to write to the Event Log via script because I want a way to easily automate the creation in the Event Log of an entry for the sole purpose of knowing when my computer was shutdown and when it started. Think of this as a basic security measure. It's possible that my computer is being used when I am not aware and I'd like to be able to look at the Event log and see an entry for each time Windows was started and shutdown; a simple entry for viewing this. I know there are probably numeorus events in various logs one could look for to see Windows Start/Shutdown but I'd like to setup my own that I know is set to run always and is easy to locate in the log.

    I've spent well over 8 hours over several days attempting to find a simple solution for this. I've looked at every Windows scripting tehcnology I coudl find from WSH to PowerShell to VbScript & JScript and I can't find anything that works. I admit I haven't learned the ins & outs of every one of these scripting methods but that's because I don't want to spend that much time just to get a single script to perform a single task.

    Any help would be very much appreciated.

    Thank You

  2. #2
    Administrator
    Join Date
    Mar 2001
    Location
    St Louis, Missouri, USA
    Posts
    23,594
    Thanks
    5
    Thanked 1,059 Times in 928 Posts

    Re: How to - Write to Windows Event Log with a script

    System shutdown and startup are already logged. Look for eventids 6006 (event log service stopped), 6009 (processor free), & 6005 (event log service started). If you still want to pursue something on your own I'd suggest you start at Welcome to the Script Center. There is software and scripts available.

    Joe
    Joe

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •