-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcess-ETLReports.ps1
More file actions
36 lines (27 loc) · 1.5 KB
/
Process-ETLReports.ps1
File metadata and controls
36 lines (27 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Processes all ETL files in a folder with a single processor flag
# 2024 Chad Schultz
param (
[Parameter(Mandatory=$true)][System.IO.DirectoryInfo] $ETLReportsPath,
[Parameter(Mandatory=$true)][System.IO.DirectoryInfo] $ETLFilespath,
[Parameter(Mandatory=$true)][ValidateSet("processes","tasks","gpos","winlogon","pnp","services","hardfaults","diskio","fileio","providerinfo","minifilter","minifiltersummary","cpusample","cpusamplenoidle","bootphases","processzombies")][string] $Processor,
[Parameter(Mandatory=$true)][System.IO.DirectoryInfo] $OutputFolder
)
Write-Verbose "ETLReports path: $ETLReportsPath"
if (Test-Path -Path $ETLFilespath -PathType Container) {
Write-Verbose "Path $ETLFilespath good."
$etlfiles = (Get-ChildItem -Path $ETLFilespath | Where-Object {$_.Extension.ToLower() -eq ".etl"})
$count_etlfiles = $etlfiles.Count
Write-Verbose "Path $ETLFilespath has $count_etlfiles .etl files."
Pause
foreach($file in $etlfiles) {
$count += 1
$filename = $file.FullName
Write-Verbose "Processing file #$count - $filename to $OutputFolder"
$procargs = "--infile:`"$filename`" --processor:$Processor --outfolder:`"$OutputFolder`""
Write-Verbose $procargs
Write-Verbose ""
Start-Process -FilePath $ETLReportsPath -ArgumentList $procargs -Wait
}
}
# Remove very small datasets
$etlfiles = (Get-ChildItem -Path $OutputFolder | Where-Object { ($_.Extension.ToLower() -eq ".csv" -and $_.Length -lt 16) }) | Remove-Item