?
Solved

vbs script to write to application log file

Posted on 2004-08-05
3
Medium Priority
?
1,557 Views
Last Modified: 2010-04-14
I have some vbs scripts, actually windows script host stuff.  I ask for a vbs script that writes a message to the applicaton log file, that is, that which is viewed by the event viewer.  I will then integrate that into my existing vbs scripts.
0
Comment
Question by:astar666
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Expert Comment

by:jdeclue
ID: 11729777
Here is a link to code snippets and examples for writing to the event log with Visual Basic. Watch out for the pop-ups.


http://kandkconsulting.tripod.com/VB/VBCode.htm
0
 

Author Comment

by:astar666
ID: 11730318
I do not have visual basic on my machine, but I search around on the web page to find the code you referenced, thinking it might provide a clue.  I did not find it.  For completeness, here is an example vbs script which I want to write to the application event log file.

set WshShell = CreateObject("WScript.Shell")
WshShell.Run "%SystemRoot%\System32\cleanmgr.exe"
WScript.Sleep 2000

WshShell.SendKeys "{ENTER}"
wscript.sleep 1000

While WshShell.AppActivate("Disk Cleanup for")= FALSE
  wscript.sleep 5000
Wend

wscript.sleep 1000
WshShell.SendKeys "{ENTER}"

wscript.sleep 1000
WshShell.SendKeys "{ENTER}"

While WshShell.AppActivate("Disk Cleanup for")= FALSE
      wscript.sleep 5000
Wend
0
 
LVL 16

Accepted Solution

by:
mdiglio earned 500 total points
ID: 11731496
Hello,
From the MS Website here is a script that will write to the application event log file
of the local machine

Const EVENT_SUCCESS = 0
Set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.LogEvent EVENT_SUCCESS, _
    "Payroll application successfully installed."


to write to the application event log file on a remote machine:

Const EVENT_SUCCESS = 0
Set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.LogEvent EVENT_SUCCESS, _
    "Payroll application successfully installed." , "\\PrimaryServer"

Good Luck!
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question