Skip to content

Instantly share code, notes, and snippets.

@acast15
Last active January 24, 2021 01:58
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 acast15/6177533a7ffa12775e922a4b063987f9 to your computer and use it in GitHub Desktop.
Save acast15/6177533a7ffa12775e922a4b063987f9 to your computer and use it in GitHub Desktop.
# Get-LatestAppLog.ps1
## Define the log file
$logDir = 'c:\temp'
$logFile = "$logDir\AppLog_$(Get-Date -format 'yyyy-mm-dd_hh-mm-ss-tt').xml"
## Get the ten latest application log events and export as an xml file
Get-WinEvent -LogName application -MaxEvents 10 |
Export-CliXml $logFile -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment