Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows Event Log - Security Log

Status
Not open for further replies.

alfie002

Technical User
Mar 3, 2004
121
GB
Dear Forum Users,

I have searched through the forum posts and did not find a close match to my search, hence my forum post.

I want to be able to write to the Security Log within the Windows Event log(s). From previous reading I don't believe it is possible using the WSH or the WMI interfaces. I would like confirmation of this from the forum and equally, any advice to point me in the right direction.

Thanks and regards,

Alf
 
You can only write to the Application log if using the default logs. You can however create your own custom event log and write to it. So you could make a "Custom_Security" log if you wanted and write to that.

Create a custom log
Code:
Const NO_VALUE = Empty

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite _
    "HKLM\System\CurrentControlSet\Services\EventLog\Custom_Security\", NO_VALUE

Write to the custom log
Code:
Set WshShell = WScript.CreateObject("WScript.Shell")

strCommand = "eventcreate /T Error /ID 100 /L Custom_Security /D " & _
    Chr(34) & "Test event." & Chr(34)
WshShell.Run strcommand

Note that you can name the log anything you want, it does not have to be Custom_Security.

I hope that helps.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Hello Mark,

Many thanks for you thoughts on the question. I have made a record of you recommendation. However Mark, in this case I want to be able to write to the Security log itself. We use software monitoring agents that monitor the entries in the Security log. We want to use the existing monitoring agents and therefore be able to write to the Security log.

Should I find a solution I will post it into this thread for you and others.

Thanks and regards,

Alf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top