mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-02-05 23:40:10 +00:00
Improve reporting tool
Display appx package dependency full names
This commit is contained in:
@@ -2,6 +2,9 @@ function Microwin-NewReportingTool {
|
||||
|
||||
# embedding reporting tool with here string
|
||||
$reportingTool = @'
|
||||
#requires -version 5.0
|
||||
#requires -runasadministrator
|
||||
|
||||
function Get-ComputerInventory {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
@@ -136,9 +139,9 @@ function Microwin-NewReportingTool {
|
||||
$inv = "$($hinv)`n`n$($sinv)"
|
||||
|
||||
return $inv
|
||||
}
|
||||
}
|
||||
|
||||
function Get-ImageInventory {
|
||||
function Get-ImageInventory {
|
||||
$imageInv = "---- IMAGE INFORMATION:`n"
|
||||
Write-Host "Getting operating system packages..."
|
||||
|
||||
@@ -193,16 +196,19 @@ function Get-ImageInventory {
|
||||
$imageInv += "`n - User Information: $($_.PackageUserInformation | Foreach-Object {
|
||||
@(
|
||||
"`n - For SID: $($_.UserSecurityId.Sid):"
|
||||
"`n - Name: $($_.UserSecurityId.Username.Replace("$env:USERNAME", "<Your user>"))"
|
||||
"`n - Name: $($_.UserSecurityId.Username.Replace("$env:USERNAME", "Your user"))"
|
||||
"`n - State: $($_.InstallState)"
|
||||
)
|
||||
|
||||
})"
|
||||
})"
|
||||
$imageInv += "`n - Is a resource package?: $($_.IsResourcePackage)"
|
||||
$imageInv += "`n - Is a bundle? $($_.IsBundle)"
|
||||
$imageInv += "`n - Is in development mode? $($_.IsDevelopmentMode)"
|
||||
$imageInv += "`n - Is non removable? $($_.NonRemovable)"
|
||||
$imageInv += "`n - Dependencies: $($_.Dependencies)"
|
||||
$imageInv += "`n - Dependencies: $($_.Dependencies | Foreach-Object {
|
||||
@(
|
||||
"`n - $($_.PackageFullName)"
|
||||
)
|
||||
})"
|
||||
$imageInv += "`n - Is partially staged? $($_.IsPartiallyStaged)"
|
||||
$imageInv += "`n - Signature kind: $($_.SignatureKind)"
|
||||
$imageInv += "`n - Status: $($_.Status)"
|
||||
@@ -248,9 +254,9 @@ function Get-ImageInventory {
|
||||
}
|
||||
|
||||
return $imageInv
|
||||
}
|
||||
}
|
||||
|
||||
function Prepare-SetupLogs {
|
||||
function Prepare-SetupLogs {
|
||||
param (
|
||||
[Parameter(Mandatory = $true, Position = 0)] [string]$pantherLogsPath
|
||||
)
|
||||
@@ -283,9 +289,9 @@ function Prepare-SetupLogs {
|
||||
|
||||
# if we failed to create the EVTX out of the ETL, at least include a way to convert it manually
|
||||
"tracerpt `".\setup.etl`" -o `".\setup.evtx`" -of EVTX -y -lr" | Out-File -Force -Encoding UTF8 -FilePath "$pantherLogsPath\convertEtl.bat"
|
||||
}
|
||||
}
|
||||
|
||||
function Prepare-CBSLogs {
|
||||
function Prepare-CBSLogs {
|
||||
param (
|
||||
[Parameter(Mandatory = $true, Position = 0)] [string]$cbsLogsPath
|
||||
)
|
||||
@@ -307,9 +313,9 @@ function Prepare-CBSLogs {
|
||||
# we copy the CBS logs
|
||||
Write-Host "Copying CBS logs..."
|
||||
Copy-Item -Path "$env:SYSTEMROOT\Logs\CBS\CBS.log" -Destination "$cbsLogsPath\cbs.log" -Force -Verbose -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
function Prepare-DismLogs {
|
||||
function Prepare-DismLogs {
|
||||
param (
|
||||
[Parameter(Mandatory = $true, Position = 0)] [string]$dismLogsPath
|
||||
)
|
||||
@@ -333,9 +339,9 @@ function Prepare-DismLogs {
|
||||
Copy-Item -Path "$env:SYSTEMROOT\Logs\DISM\dism.log" -Destination "$dismLogsPath\dism.log" -Force -Verbose -ErrorAction SilentlyContinue
|
||||
Compress-Report -itemToCompress "$dismLogsPath\dism.log" -Destination "$dismLogsPath\dismLog.zip"
|
||||
if ($?) { Remove-Item -Path "$dismLogsPath\dism.log" -Force -Verbose }
|
||||
}
|
||||
}
|
||||
|
||||
function Compress-Report {
|
||||
function Compress-Report {
|
||||
param (
|
||||
[Parameter(Mandatory = $true, Position = 0)] [string]$itemToCompress,
|
||||
[Parameter(Mandatory = $true, Position = 1)] [string]$destinationZip
|
||||
@@ -346,40 +352,40 @@ function Compress-Report {
|
||||
} catch {
|
||||
Write-Host "ZIP file could not be created..."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$version = "1.0"
|
||||
$version = "1.0"
|
||||
Clear-Host
|
||||
Write-Host "MicroWin reporting tool -- version $version"
|
||||
Write-Host "-------------------------------------------"
|
||||
Write-Host "Saving system information to a report file. The report file will be saved to your desktop. This will take some time..."
|
||||
|
||||
Write-Host "MicroWin reporting tool -- version $version"
|
||||
Write-Host "-------------------------------------------"
|
||||
Write-Host "Saving system information to a report file. The report file will be saved to your desktop. This will take some time..."
|
||||
$mwReportToolPath = "$env:USERPROFILE\Desktop\MWReportToolFiles"
|
||||
|
||||
$mwReportToolPath = "$env:USERPROFILE\Desktop\MWReportToolFiles"
|
||||
# first some computer inventory
|
||||
New-Item -ItemType Directory -Path "$mwReportToolPath" -Force | Out-Null
|
||||
Get-ComputerInventory | Out-File -Force -Encoding UTF8 -FilePath "$mwReportToolPath\computerReport.txt"
|
||||
Get-ImageInventory | Out-File -Force -Encoding UTF8 -FilePath "$mwReportToolPath\imageReport.txt"
|
||||
|
||||
# first some computer inventory
|
||||
New-Item -ItemType Directory -Path "$mwReportToolPath" -Force | Out-Null
|
||||
Get-ComputerInventory | Out-File -Force -Encoding UTF8 -FilePath "$mwReportToolPath\computerReport.txt"
|
||||
Get-ImageInventory | Out-File -Force -Encoding UTF8 -FilePath "$mwReportToolPath\imageReport.txt"
|
||||
# next some setup logs
|
||||
New-Item -ItemType Directory -Path "$mwReportToolPath\PantherSetup" -Force | Out-Null
|
||||
New-Item -ItemType Directory -Path "$mwReportToolPath\ComponentBasedServicing" -Force | Out-Null
|
||||
New-Item -ItemType Directory -Path "$mwReportToolPath\DISM" -Force | Out-Null
|
||||
Prepare-SetupLogs -pantherLogsPath "$mwReportToolPath\PantherSetup"
|
||||
Prepare-CBSLogs -cbsLogsPath "$mwReportToolPath\ComponentBasedServicing"
|
||||
Prepare-DismLogs -dismLogsPath "$mwReportToolPath\DISM"
|
||||
|
||||
# next some setup logs
|
||||
New-Item -ItemType Directory -Path "$mwReportToolPath\PantherSetup" -Force | Out-Null
|
||||
New-Item -ItemType Directory -Path "$mwReportToolPath\ComponentBasedServicing" -Force | Out-Null
|
||||
New-Item -ItemType Directory -Path "$mwReportToolPath\DISM" -Force | Out-Null
|
||||
Prepare-SetupLogs -pantherLogsPath "$mwReportToolPath\PantherSetup"
|
||||
Prepare-CBSLogs -cbsLogsPath "$mwReportToolPath\ComponentBasedServicing"
|
||||
Prepare-DismLogs -dismLogsPath "$mwReportToolPath\DISM"
|
||||
|
||||
# finally we pack everything
|
||||
"This file contains reporting information that can be used to help us diagnose issues," | Out-File -Force -Encoding UTF8 -FilePath "$mwReportToolPath\README.txt"
|
||||
"if you run into any. It is safe to delete this file if you don't want it, but we" | Out-File -Append -Encoding UTF8 -FilePath "$mwReportToolPath\README.txt"
|
||||
"recommend that you move it instead. (You might need this at any time). If it exceeds" | Out-File -Append -Encoding UTF8 -FilePath "$mwReportToolPath\README.txt"
|
||||
"GitHub's maximum size limit, you can try recompressing the ZIP file with 7-Zip and a" | Out-File -Append -Encoding UTF8 -FilePath "$mwReportToolPath\README.txt"
|
||||
"higher compression level or removing the biggest files in there.`n" | Out-File -Append -Encoding UTF8 -FilePath "$mwReportToolPath\README.txt"
|
||||
"The Reporting Tool was made by CodingWonders (https://github.com/CodingWonders) for" | Out-File -Append -Encoding UTF8 -FilePath "$mwReportToolPath\README.txt"
|
||||
"the purpose of it being useful." | Out-File -Append -Encoding UTF8 -FilePath "$mwReportToolPath\README.txt"
|
||||
Write-Host "Preparing report ZIP file..."
|
||||
Compress-Report -itemToCompress "$mwReportToolPath" -destinationZip "$mwReportToolPath\..\MicroWinReportTool_$((Get-Date).ToString('yyMMdd-HHmm')).zip"
|
||||
Remove-Item -Path "$mwReportToolPath" -Recurse
|
||||
# finally we pack everything
|
||||
"This file contains reporting information that can be used to help us diagnose issues," | Out-File -Force -Encoding UTF8 -FilePath "$mwReportToolPath\README.txt"
|
||||
"if you run into any. It is safe to delete this file if you don't want it, but we" | Out-File -Append -Encoding UTF8 -FilePath "$mwReportToolPath\README.txt"
|
||||
"recommend that you move it instead. (You might need this at any time). If it exceeds" | Out-File -Append -Encoding UTF8 -FilePath "$mwReportToolPath\README.txt"
|
||||
"GitHub's maximum size limit, you can try recompressing the ZIP file with 7-Zip and a" | Out-File -Append -Encoding UTF8 -FilePath "$mwReportToolPath\README.txt"
|
||||
"higher compression level or removing the biggest files in there.`n" | Out-File -Append -Encoding UTF8 -FilePath "$mwReportToolPath\README.txt"
|
||||
"The Reporting Tool was made by CodingWonders (https://github.com/CodingWonders) for" | Out-File -Append -Encoding UTF8 -FilePath "$mwReportToolPath\README.txt"
|
||||
"the purpose of it being useful." | Out-File -Append -Encoding UTF8 -FilePath "$mwReportToolPath\README.txt"
|
||||
Write-Host "Preparing report ZIP file..."
|
||||
Compress-Report -itemToCompress "$mwReportToolPath" -destinationZip "$mwReportToolPath\..\MicroWinReportTool_$((Get-Date).ToString('yyMMdd-HHmm')).zip"
|
||||
Remove-Item -Path "$mwReportToolPath" -Recurse
|
||||
'@
|
||||
|
||||
$reportingTool | Out-File -FilePath "$env:TEMP\reportTool.ps1" -Force
|
||||
|
||||
Reference in New Issue
Block a user