1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# =========================================================================================================== # # Created by: Trentent Tye # Intel Server Team # IBM Canada Ltd. # # Creation Date: Apr 10, 2014 # # File Name: Move-Log-Files.ps1 # # Description: This script will be used to move all the log files from the default SYSTEMDRIVE to # a drive of your choosing (in this case, D:\EventLogs). We use this for non-persistent # vDisks with a persistent write cache to keep these logs for troubleshooting purposes. # # =========================================================================================================== # Change D:\EventLogs to some other destination if required. $allLogs = Get-WinEvent -ListLog * foreach ($logs in $allLogs) { $filename = split-path $logs.LogFilePath -leaf $logs.LogFilePath = “D:\EventLogs\ $logs.SaveChanges() } |