Link to home
Start Free TrialLog in
Avatar of astar666
astar666Flag for United States of America

asked on

vbs script to write to application log file

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.
Avatar of jdeclue
jdeclue

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
Avatar of astar666

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of mdiglio
mdiglio
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial