Skip to main content

IIS Log cleaner (old) method to clean all the IIS logs

IIS Log cleaner






'Determine the number of days for which you want to keep logs
logDelDays = 30

'Main driver
purgeIISLogs("W3SVC")
purgeIISLogs("MSFTPSVC")

'Purge IIS logs
Sub purgeIISlogs(strService)
    delCount   = 0
    Set fso    = CreateObject("Scripting.FileSystemObject")
    Set objIIS = GetObject("IIS://" & getComputer() & "/" & strService)
    For Each objweb in objIIS
        If lCase(objweb.Class) = "iiswebserver" _
        Or lCase(objweb.Class) = "iisftpserver" Then
            fLogDirPath = objweb.LogFileDirectory & "\" & strService & objweb.name
            If fso.FolderExists(fLogDirPath) Then
                For Each fLog in fso.GetFolder(fLogDirPath).Files
                    If UCase(Left(fLog.Name,2)) = "EX" And UCase(Right(fLog.Name,4)) = ".LOG" Then
                        fileDate = cDate(Mid(fLog.name,7,2) & " " & monthname(cint(Mid(fLog.name,5,2)),true) & " " & Mid(fLog.name,3,2))
                        If fileDate < DateAdd("d", now(), -logDelDays) Then
                            delCount = delCount + 1
                            fLog.Delete
                        End If
                    End If
                Next
                Wscript.Echo "Purged " & delCount & " logs for " & objweb.ServerComment
            End If
        End If
    Next
    Set objIIS = nothing
    Set fso    = nothing
End Sub

'Get computer name
Function getComputer()
    Set objNet = WScript.CreateObject("WScript.Network")
    getComputer= objNet.ComputerName
    Set objNet = Nothing
End Function

Comments

Popular posts from this blog

Moodle 3.8.1+ - path leak via errors in several files

Moodle 3.8.1+ ----------------------------------------------- File: admin/mailout-debugger.php #!/usr/bin/php Notice : Disabled. in \admin\mailout-debugger.php on line 73 File: admin/settings/appearance.php Notice : Undefined variable: hassiteconfig in \admin\settings\appearance.php on line 10 Fatal error : Uncaught Error: Call to undefined function has_any_capability() in \admin\settings\appearance.php:10 Stack trace: #0 {main} thrown in \admin\settings\appearance.php on line 10 File: admin/settings/badges.php Notice : Undefined variable: hassiteconfig in \admin\settings\badges.php on line 30 Fatal error : Uncaught Error: Call to undefined function has_any_capability() in \admin\settings\badges.php:30 Stack trace: #0 {main} thrown in \admin\settings\badges.php on line 30 File: admin/settings/courses.php Notice : Undefined variable: hassiteconfig in \admin\settings\courses.php on line 32 Fatal error : Uncaught Error: Call to undefined function

2022 - Remove (the too many) Ads from Memu launcher

Simple method Download from pureapk "MEmu Launcher2" ex: MEmu Launcher2_v6.0.9_apkpure.com Install "System app remover" (root) remove from system apps the "memu launcher 2" import the "purified" MEmu Launcher2 apk with the Memu utility ("apk" on the right toolbar) Longer method Install "Export Apk" Export the memu launcher2  Install purify https://github.com/echo-devim/purify/raw/master/Purify.apk use purify with the exported memu launcher 2 Install "System app remover" (root) remove from system apps the "memu launcher 2" import the "purified" MEmu Launcher2 apk with the Memu utility ("apk" on the right toolbar)