Skip to content

Commit

Permalink
RHEL-69597: [CollectSystemInfo] Gather SetupAPI logs
Browse files Browse the repository at this point in the history
Signed-off-by: Vitalii Chulak <[email protected]>
  • Loading branch information
Jedoku authored and YanVugenfirer committed Dec 11, 2024
1 parent 056e4e8 commit a01c696
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
23 changes: 23 additions & 0 deletions Tools/debug/CollectSystemInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,28 @@ function Export-WindowsMemoryDump {
Write-Host 'Windows memory dump collection completed.'
}

function Export-SetupAPILogs {
try {
$infPath = "$env:SystemRoot\INF"
$files = Get-ChildItem -Path $infPath -Filter 'setupapi*.log'

if (Test-Path "$env:SystemRoot\setupapi.log") {
$files += Get-Item "$env:SystemRoot\setupapi.log"
}

foreach ($file in $files) {
try {
Copy-Item -Path $file.FullName -Destination $logfolderPath -ErrorAction Stop
} catch {
Write-Warning "Failed to copy $($file.Name): $_"
}
}
Write-Host 'SetupAPI logs collection completed.'
} catch {
Write-Warning "Failed to collect SetupAPI logs: $_"
}
}

function Write-InformationToArchive {
param (
[string]$FolderPath,
Expand Down Expand Up @@ -265,6 +287,7 @@ try {
Export-InstalledApplications
Export-InstalledKBs
Export-NetworkConfiguration
Export-SetupAPILogs

if ($IncludeSensitiveData) {
Write-Output "Dump folder path: $dumpfolderPath"
Expand Down
3 changes: 2 additions & 1 deletion Tools/debug/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

This PowerShell script is designed for comprehensive system diagnostics. It gathers a wide range of information, including system configuration, event logs, drivers, registry settings, update logs, services, uptime, processes, installed applications, installed KBs (knowledge base articles), network configuration, and optionally, memory dumps.
This PowerShell script is designed for comprehensive system diagnostics. It gathers a wide range of information, including system configuration, event logs, driver lists, SetupAPI logs, registry settings, update logs, services, uptime, processes, installed applications, installed KBs (knowledge base articles), network configuration, and optionally, memory dumps.

The collected data is organized into two subfolders within the time-stamped summary folder, one for log and the other for dump. and then compressed into two ZIP archives correspondingly for easy sharing and analysis.

Expand Down Expand Up @@ -47,6 +47,7 @@ The collected data is organized into two subfolders within the time-stamped summ
- `InstalledApplications.csv`: List of installed applications.
- `InstalledKBs.csv`: List of installed Windows updates.
- `NetworkInterfaces.txt` and `IPConfiguration.txt`: Network configuration details.
- `setupapi*.log`: Logs related to device and driver installations.
- `MEMORY.DMP` and `Minidump` folder: Full or mini memory dumps (if `-IncludeSensitiveData` is used).
- `Collecting_Status.txt`: Generated during data collection and deleted after completion. If the script is interrupted, this file indicates incomplete data collection.
Expand Down

0 comments on commit a01c696

Please sign in to comment.