KB10107 - PS: Start-Archive - Example: Archive IIS Logfiles

This example is for the script >> Start-Archive.ps1.

It archives all log files in a defined logfolder to a daily archive folder.


Script code:

	
#FileName: SCHEDULER-CleanIISLogs.ps1
$LogPath = "C:\inetpub\logs\LogFiles\W3SVC1"
$ArchivePath = "C:\_Archive\IISLogs\"
.\Start-Archive.ps1 -InputPath $LogPath `
                        -ArchiveFileName ($ArchivePath+(Get-Date -Format "yyyyMMdd")+".zip") `
                        -SevenZipExecutablePath "C:\Scripts\Start-Archive\7za.exe" `
                        -InputFileMask "*.log" `
                        -InputMinFileAgeDays 14 `
                        -LogFilePath ($ArchivePath+"Logging") `
                        -LogFileBaseName "_Archive-IISLogs.log" `
                        -LogFileDateTime "yyyyMMdd" `
                        -DeleteSourceFiles $true
	

>> syntax highlighting powered by highlight.js