uj könyvtär Scripts

This commit is contained in:
2025-12-15 10:00:38 +01:00
parent c06d51509d
commit 0c3b5e75a6
43 changed files with 1957 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
$events = Get-WinEvent -LogName "Microsoft-Windows-PrintService/Operational" -MaxEvents 500 |
Where-Object { $_.Id -eq 307 }
$logList = @()
foreach ($event in $events) {
$message = $event.Message
$user = ""
$document = ""
$printer = ""
$pages = ""
# Felhasználó (pl. L.Vogt auf APS-NB072)
if ($message -match "im Besitz von (.+?) wurde auf") {
$user = $matches[1].Trim()
}
# Nyomtató neve (pl. Jasenitz)
if ($message -match "wurde auf (.+?) über Port") {
$printer = $matches[1].Trim()
}
# Oldalszám (pl. Gedruckte Seiten: 1)
if ($message -match "Gedruckte Seiten:\s+(\d+)") {
$pages = $matches[1]
}
# Dokumentum sorszám (pl. Dokument 62) jobb híján
if ($message -match "^Dokument\s+(\d+)") {
$document = "Dokument " + $matches[1]
}
$logList += [PSCustomObject]@{
Datum = $event.TimeCreated
Benutzer = $user
Dokument = $document
Drucker = $printer
Seiten = $pages
}
}
# Exportálás CSV-be
$exportPfad = "$env:USERPROFILE\Desktop\drucklog_export.csv"
$logList | Export-Csv -Path $exportPfad -NoTypeInformation -Encoding UTF8
Write-Host "Exportálás kész: $exportPfad"