This little script can change the path to the event logs. THis code enumerates all the Event Logs (not just the 4 Windows Logs) you see under Event Viewer in WIndows 2008 and above and change the location of all of them to a new location. For convinence, the script is written as a function and can be used to change the event log path on local (default) or remote computer.

usage : Set-Eventlogpath -Computername <<computername>> -NewLogDir <<New Path to store Event logs>>

 

PowerShell
Edit|Remove
Function Set-EventlogPath ([string]$Computername=$env:COMPUTERNAME,[string]$NewLogDir) 
{ 
    [reflection.assembly]::loadwithpartialname("System.Diagnostics.Eventing.Reader") 
    $Eventlogsession = New-Object System.Diagnostics.Eventing.Reader.EventLogSession -ArgumentList $Computername 
    Foreach($LogName in $Eventlogsession.GetLogNames())    { 
        $Eventlogconfig = New-Object System.Diagnostics.Eventing.Reader.EventLogConfiguration -ArgumentList $LogName,$Eventlogsession 
        $Logfilepath = $Eventlogconfig.LogFilePath 
        $Logfile = Split-Path $Logfilepath -Leaf 
        $NewLogFilePath = "$NewLogDir\$Logfile" 
 
         Write-Host -ForegroundColor Yellow $LogName,$Logfilepath,$Eventlogconfig.LogType 
         
        if (($Eventlogconfig.LogType -eq "Debug" -or$Eventlogconfig.LogType -eq " Analytical"-and $Eventlogconfig.IsEnabled) 
        { 
            $Eventlogconfig.IsEnabled = $false 
            $Eventlogconfig.SaveChanges()  
 
            $Eventlogconfig.LogFilePath = $NewLogFilePath 
            $Eventlogconfig.SaveChanges()  
 
            $Eventlogconfig.IsEnabled = $true 
            $Eventlogconfig.SaveChanges() 
            } 
        else 
        { 
            $Eventlogconfig.LogFilePath = $NewLogFilePath 
            $Eventlogconfig.SaveChanges() 
            } 
        } 
    }