Advertisement
guyrleech

Reconfigure File Path for all Event Logs

Sep 22nd, 2020 (edited)
550
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [string]$newPath = 'D:\eventlogs'
  2.  
  3. New-Item -Path $newPath -Type Directory -Force
  4.  
  5. Get-WinEvent -ListLog * | ForEach-Object { $_.LogFilePath = (Join-Path -Path $newPath -ChildPath (Split-Path $_.LogFilePath -Leaf)) ; $_.SaveChanges() }
  6.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement