Thursday, April 10, 2014
Move ALL Windows 7/2008/2012 log files to another drive
# ===========================================================================================================
#
# 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\$filename”
$logs.SaveChanges()
}
No comments:
Post a Comment