Ga naar de inhoud

Steijvers.com : over IT, eten en plaatjes draaien

  • Home
  • Koken met Steijvers
  • Tech
    • Windows Server
    • Exchange Server 2019
    • Exchange Server SE
    • Powershell
    • Veeam
    • VMware
    • Hyper-V
    • Proxmox
    • UniFi
    • Hewlett Packard Enterprise
  • Vinyl/Vintage Audio
    • Thorens
    • Dual
  • Fotoblog
  • Over mij
    • Bas
    • Curriculum Vitae
    • Contact
  • Links
logo powershell

SessionStart en Stops loggen

9 december 2020 Bas Tech

Voor troubleshooting doeleinden is het ooit wenselijk snel te weten wie wanneer actief was op een machine. Met het onderstaande powershell script haal je deze informatie snel uit de eventviewer logging en zet je het in een text bestand.

$Results = @()
$logs =Get-WinEvent -LogName Security| Where-Object {$_.ID -eq 4634 -or $_.ID -eq 4624}
ForEach ($log in $logs)
{
if ($log.Id -eq 4634)
{
$type=”SessionStop”
$username=$log.Properties[1].Value
}
Else {
$type=”SessionStart”
$username=$log.Properties[5].Value
}
if ($username -ne “”) {
$Results += New-Object PSObject -Property @{“Time” = $log.TimeCreated; “Event” = $type; “User” = $username};
}
}
$Results > c:\logonlogging.txt
loggingloginlogoffmicrosoftpowershell

Bericht navigatie

Vorige bericht:Top 2000 thuispakket in de pocket
Volgende bericht:Janna’s eerste wen-ochtend op de basisschool
  • LinkedIn

Onlangs toegevoegd

  • VMware ESXi 8.0U3i
  • Exchange Server Subscription Edition en een IPBlocklistprovider
  • VMware PSOD: UEFI Secure Boot failed
  • HPE Service Pack for ProLiant 2026.01.00.00
  • HPE Service Pack for ProLiant 2025.11.00.00
  • Virus & Threat protection uitschakelen
  • Veeam : the request does not have valid authentication credentials
  • fijne feestdagen!
  • VMware ESXi 8.0U3h
  • Je eigen UniFi OS Server opzetten

Archieven

© 2000 – 2026 Familie Steijvers, onderdeel van SUSSE.NET

WordPress thema: Poseidon door ThemeZee.