Skip to content

Commit

Permalink
added clean-up at collection end (#94)
Browse files Browse the repository at this point in the history
Co-authored-by: Kubilay <khusmeno@khusmeno.com>
  • Loading branch information
khusmeno and Kubilay authored Jul 10, 2023
1 parent c0eb6f1 commit 5475df7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions SCSM-Diagnostic-Tool/SourceCode/_1_Collecting/Collect.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ foreach($psJob in Get-Job) {
}
#endregion

#region Some clean-up
if (! (Get-Process -Name wevtutil -ErrorAction SilentlyContinue) ) {
Get-ChildItem -Path ( [System.IO.Path]::Combine( $env:windir, 'ServiceProfiles\LocalService\AppData\Local\Temp') ) -Filter "EVT*.tmp" -ErrorAction SilentlyContinue | Remove-Item -ErrorAction SilentlyContinue
Get-ChildItem -Path ( [System.IO.Path]::Combine( $env:windir, 'ServiceProfiles\LocalService\AppData\Local\Temp') ) -Filter "MSG*.tmp" -ErrorAction SilentlyContinue | Remove-Item -ErrorAction SilentlyContinue
Get-ChildItem -Path ( [System.IO.Path]::Combine( $env:windir, 'ServiceProfiles\LocalService\AppData\Local\Temp') ) -Filter "PUB*.tmp" -ErrorAction SilentlyContinue | Remove-Item -ErrorAction SilentlyContinue
}
#endregion

#region Collector Final tasks
Write-Host ""
$completionDateTime = (Get-Date).ToString("yyyy-MM-dd__HH.mm.ss.fff")
Expand Down

0 comments on commit 5475df7

Please sign in to comment.