shell-scripts/ps/generic/uninstall_install_history.ps
2026-01-23 12:33:26 +01:00

60 lines
1.8 KiB
PostScript

# --------------------------------------------
# SOFTWARE INSTALL / UNINSTALL HISTORY
# --------------------------------------------
Write-Host "`n=== SOFTWARE INSTALLATIONEN (Registry + Store) ===`n" -ForegroundColor Cyan
# --- Installationen über Registry ---
$regPaths = @(
"HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*",
"HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*",
"HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*"
)
$installs = foreach ($path in $regPaths) {
Get-ItemProperty $path -ErrorAction SilentlyContinue |
Where-Object { $_.DisplayName -and $_.InstallDate } |
Select-Object @{
Name="Date"; Expression={
try {
[datetime]::ParseExact($_.InstallDate, "yyyyMMdd", $null)
} catch {
$null
}
}
}, DisplayName, DisplayVersion, Publisher, UninstallString
}
# --- Installationen über Windows Store (AppX) ---
$appx = Get-AppxPackage |
Select-Object @{
Name = "Date";
Expression = { $_.InstallDate }
}, Name, Version, Publisher
$allInstalls = $installs + $appx | Sort-Object Date
$allInstalls | Format-Table Date, DisplayName, DisplayVersion, Publisher -AutoSize
# --------------------------------------------
Write-Host "`n=== SOFTWARE DEINSTALLATIONEN (Event Viewer) ===`n" -ForegroundColor Yellow
# MsiInstaller Events:
# 1034 = Uninstall
# 11724 = Removal success
# 11707 = Install success (info only)
$events = Get-WinEvent -FilterHashtable @{
LogName = "Application"
ProviderName = "MsiInstaller"
} -ErrorAction SilentlyContinue |
Where-Object {
$_.Id -eq 1034 -or $_.Id -eq 11724
} |
Select-Object TimeCreated, Id, Message
$events | Sort-Object TimeCreated |
Format-Table TimeCreated, Id, Message -Wrap -AutoSize
Write-Host "`nFertig!`n"