Solved

vbs script to write to application log file

Posted on 2004-08-05
3
1,551 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 125 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

Suggested Solutions

Title # Comments Views Activity
Remote Access to a Windows 2000 Computer 2 518
Images sometimes not printed 6 491
Windows Explorer and WinZXip 4 541
VBScript not processed at Windows 8.1 logon 2 8,060
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…
When using a search centre, I'm going to show you how to configure Sharepoint's search to only return results from the current site collection. Very useful when using Office 365 with multiple site collections.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 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