WSH and Event Log  
Author Message
MattW





PostPosted: Fri Oct 06 13:53:01 CDT 2006 Top

VB Scripts >> WSH and Event Log

I am posting a record to the Event Log via the code below, but the USER
field in the Event Details is populated with User: N/A. This appears to be
standard with WSH. Is this so?

Is there anyway I can populate I can get this field populated with the user
running the script?

objShell.LogEvent 8 , "User " &
objShell.ExpandEnvironmentStrings("%USERDOMAIN%") _
& "\" &
objShell.ExpandEnvironmentStrings("%USERNAME%") _
& " has logged on via " _
& objShell.ExpandEnvironmentStrings("%SESSIONNAME%") _
& " from workstation " _
& objShell.ExpandEnvironmentStrings("%CLIENTNAME%") _
& VBCRLF _
& VBCRLF _
& "Reason for logon - " _
& Input




--
Paul Bergson
MVP - Directory Services
MCT, MCSE, MCSA, Security+, BS CSci
2003, 2000 (Early Achiever), NT

http://www.hide-link.com/

Please no e-mails, any questions should be posted in the NewsGroup
This posting is provided "AS IS" with no warranties, and confers no rights.

Visual Studio203  
 
 
dlwyattATe-wyattDOTorgNOSPAM>





PostPosted: Fri Oct 06 13:53:01 CDT 2006 Top

VB Scripts >> WSH and Event Log The only way I know of to specify that User field is to use the "ReportEvent"
function of the Win32 API, but that's not available to your VBScript unless
you write or find a custom COM object to wrap it.