# Speicherpfade für Chromium-basierte Browser (Edge/Chrome) und Firefox $ChromiumPaths = @( "AppData\Local\Google\Chrome\User Data\Default\Login Data", "AppData\Local\Microsoft\Edge\User Data\Default\Login Data" ) $FirefoxPathPart = "AppData\Roaming\Mozilla\Firefox\Profiles" # Zielnetzwerkfreigabe und Dateiname-Basis $NetworkShare = "\\desvr-file02\password_Browser$" $Hostname = [System.Environment]::MachineName Write-Host "Pruefe gespeicherte Browser-Passwoerter auf $Hostname ..." -ForegroundColor Cyan # Holt alle lokalen Benutzerprofile auf dem Rechner (außer Systemkonten) $UserProfiles = Get-CimInstance -ClassName Win32_UserProfile | Where-Object { $_.Special -eq $false -and $_.LocalPath -notlike "*\Windows*" } foreach ($Profile in $UserProfiles) { $UserName = Split-Path $Profile.LocalPath -Leaf $Path = $Profile.LocalPath $HasSavedPasswords = $false $DetectedBrowsers = @() # 1. Prüfe Chrome & Edge (Suchen nach der Datei 'Login Data') foreach ($RelPath in $ChromiumPaths) { $FullCheckPath = Join-Path $Path $RelPath if (Test-Path $FullCheckPath) { # Da die Datei immer existiert, prüfen wir, ob sie größer als die Standard-Leergröße ist (meist > 24KB) if ((Get-Item $FullCheckPath).Length -gt 30000) { $HasSavedPasswords = $true $BrowserName = if ($RelPath -match "Chrome") { "Google Chrome" } else { "Microsoft Edge" } $DetectedBrowsers += $BrowserName } } } # 2. Prüfe Firefox (Suchen nach 'logins.json') $FFProfilePath = Join-Path $Path $FirefoxPathPart if (Test-Path $FFProfilePath) { $LoginsFile = Get-ChildItem -Path $FFProfilePath -Filter "logins.json" -Recurse -ErrorAction SilentlyContinue if ($LoginsFile -and $LoginsFile.Length -gt 100) { $HasSavedPasswords = $true $DetectedBrowsers += "Mozilla Firefox" } } # Ergebnis in Textdatei auf der Netzwerkfreigabe speichern if ($HasSavedPasswords) { $ReportEntry = [PSCustomObject]@{ "Benutzer" = $UserName "Speichert" = "Ja" "Browser" = ($DetectedBrowsers -join ", ") } # Dateiname: {Hostname}_{Username}.txt $FileName = "$Hostname" + "_$($UserName).txt" $OutputPath = Join-Path $NetworkShare $FileName try { $ReportEntry | Format-Table -AutoSize | Out-String | Set-Content -LiteralPath $OutputPath Write-Host " -> Bericht gespeichert: $OutputPath" -ForegroundColor Green } catch { Write-Host " ! Fehler beim Speichern für Benutzer '$UserName': $_" -ForegroundColor Red } } } Write-Host "Fertig. Berichte liegen unter $NetworkShare" -ForegroundColor Cyan