954,558 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

retaining system log files

I'm new to Vb and need some of your EXPERT help!:mrgreen:
What I need to write or copy is a script that will
1. shut down log file services on windows 2003 server
2. copy the application/security/event files to a .csv file
3 delete entries on the logs
4 restart the log file service
nice to include is that the script runs automatically on the 5th day of the month.

Has this already been written? If so where can I get a copy? IF not who can help create such a script

Thanks
Campfishitus
email [EMAIL="campfishitus@yahoo.com"]campfishitus@yahoo.com[/EMAIL]
Name came from my 2 favorite things to do Camping and Fishing the itus is just the notation of a diesese

campfishitus
Newbie Poster
1 post since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

This might be done in a batch file:

@echo off                                 # Don't tell what steps are involved
net stop eventlog                         # Shut off the event logger
copy <logfilesource> <logfiledest>        # Be sure to insert the actual source and dest paths
del <logfilesource>                       # Again, insert the actual path
net start eventlog                        # Turn the event logger back on



Then simply run the batch file (logbackup.bat, for example) from Task Scheduler (or whatever it's been renamed to in Server 2003).

Of course, it's always possible I misunderstood exactly what you were aiming to do.

- Sendoshin

sendoshin
Light Poster
39 posts since Sep 2006
Reputation Points: 16
Solved Threads: 1
 

you could even do those steps in a VB app by itself (although, I don't see the point when the batch file works just fine). You could also make the vb app mess with services using the API

Public Declare Function OpenService Lib "advapi32.dll" Alias "OpenServiceA" (ByVal hSCManager As Long, ByVal lpServiceName As String, ByVal dwDesiredAccess As Long) As Long
Public Declare Function StartService Lib "advapi32.dll" Alias "StartServiceA" (ByVal hService As Long, ByVal dwNumServiceArgs As Long, ByVal lpServiceArgVectors As Long) As Long
Public Declare Function ControlService Lib "advapi32.dll" (ByVal hService As Long, ByVal dwControl As Long, lpServiceStatus As SERVICE_STATUS) As Long
Public Declare Function EnumDependentServices Lib "advapi32.dll" Alias "EnumDependentServicesA" (ByVal hService As Long, ByVal dwServiceState As Long, lpServices As ENUM_SERVICE_STATUS, ByVal cbBufSize As Long, pcbBytesNeeded As Long, lpServicesReturned As Long) As Long

Public Declare Function OpenSCManager Lib "advapi32.dll" Alias "OpenSCManagerA" (ByVal lpMachineName As String, ByVal lpDatabaseName As String, ByVal dwDesiredAccess As Long) As Long
Public Declare Function EnumServicesStatus Lib "advapi32.dll" Alias "EnumServicesStatusA" (ByVal hSCManager As Long, ByVal dwServiceType As Long, ByVal dwServiceState As Long, lpServices As Any, ByVal cbBufSize As Long, pcbBytesNeeded As Long, lpServicesReturned As Long, lpResumeHandle As Long) As Long
Public Declare Function CloseServiceHandle Lib "advapi32.dll" (ByVal hSCObject As Long) As Long


but I think the batch file is an easier, and more effecient way to go.

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You