Skip to content

Instantly share code, notes, and snippets.

@sbalaji6
Created October 13, 2020 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbalaji6/95bdcb595b35f1793f9ce3d0c491defb to your computer and use it in GitHub Desktop.
Save sbalaji6/95bdcb595b35f1793f9ce3d0c491defb to your computer and use it in GitHub Desktop.
[string]$randNo = Get-Random
$tempFolder = $($env:temp)+"\Logs"+"-"+$randNo+"-$(Get-Date -UFormat "%m%d%Y%H%M%S")"
New-Item -Path $tempFolder -ItemType Directory
$eventLogs = "event-logs"
#Copy event logs
New-Item -Path "$($tempFolder)\$($eventLogs)" -ItemType Directory
Copy-Item -Path "$env:SystemRoot\System32\Winevt\Logs\*" -Destination "$($tempFolder)\$($eventLogs)" -Recurse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment