GoogleDude Posted March 24, 2008 Share Posted March 24, 2008 I searched but didnt really come up with anything. Are there any UDFs out there that allow me to create a category for compiled script in the Windows Event Viewer in the event that my scripts set and error levels or var$ data maybe. Kinda like System or Applications Logs now Internet Explorer has its own category. I would like to have my own. Thanks, GoogleDude Link to comment Share on other sites More sharing options...
DarkMatter Posted March 25, 2008 Share Posted March 25, 2008 This is probably not what you want but you could do something like this: Func LogEvent($strLocation, $strType, $IntID, $strSource, $strEventMessage) Local $CheckEventViewer = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\YOURENTRY","EVENTVIEWERNAME") If Not $CheckEventViewer Then RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\EventLog\YOURENTRY","EVENTVIEWERNAME","REG_DWORD","1") EndIf Sleep(200) RunWait("EVENTCREATE /T " & $strType & " /ID " & $IntID & " /L " & $strLocation & " /SO " & $strSource & " /D " & CHR(34) & $strEventMessage & CHR(34),@SystemDir,@SW_HIDE) EndFunc The above function will check to make sure that event viewer entry is there and if it is it will log everything you specify within that event viewer log. [sub]Quantum mechanics: The dreams stuff is made of[/sub] Link to comment Share on other sites More sharing options...
ghetek Posted November 7, 2008 Share Posted November 7, 2008 (edited) DarkMatter, could you please explain these variables? $strLocation, $strType, $IntID, $strSource, $strEventMessage This is probably not what you want but you could do something like this: Func LogEvent($strLocation, $strType, $IntID, $strSource, $strEventMessage) Local $CheckEventViewer = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\YOURENTRY","EVENTVIEWERNAME") If Not $CheckEventViewer Then RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\EventLog\YOURENTRY","EVENTVIEWERNAME","REG_DWORD","1") EndIf Sleep(200) RunWait("EVENTCREATE /T " & $strType & " /ID " & $IntID & " /L " & $strLocation & " /SO " & $strSource & " /D " & CHR(34) & $strEventMessage & CHR(34),@SystemDir,@SW_HIDE) EndFunc The above function will check to make sure that event viewer entry is there and if it is it will log everything you specify within that event viewer log. Edited November 7, 2008 by ghetek Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now