Skip to content

Instantly share code, notes, and snippets.

@filipnet
filipnet / maildir_report.sh
Created February 13, 2025 07:11
This script extracts all home directories from /etc/passwd, regardless of their location. It then checks if each home directory contains a Maildir folder. If a Maildir exists, the script displays the total size of the home directory along with the size of the Maildir and its subdirectories.
#!/bin/bash
# Get all home directories from /etc/passwd
HOMEDIRS=$(awk -F: '$6 !~ /^$/ {print $6}' /etc/passwd | sort -u)
# Loop through each home directory
for dir in $HOMEDIRS; do
MAILDIR="$dir/Maildir"
# Check if the Maildir exists
@filipnet
filipnet / Get-LogonHistory.ps1
Created February 15, 2025 10:25
Retrieves logon (7001) and logoff (7002) events from the system event log of a local or remote computer Displays the results in a formatted table Allows filtering based on a specified time period (default: 10 days)
<#
.SYNOPSIS
Retrieves logon and logoff events from a local or remote computer.
.DESCRIPTION
This script queries the Windows Event Log for logon (7001) and logoff (7002) events.
The results are sorted in descending order by date and displayed in a table.
.PARAMETER Computer
The target computer name (Default: Local computer).
@filipnet
filipnet / Get-RebootEvents.ps1
Created February 15, 2025 10:35
PowerShell script saved as Get-RebootEvents.ps1 that retrieves system shutdown and reboot events for both single and multiple servers.
<#
.SYNOPSIS
Tracks system shutdown and reboot events.
.DESCRIPTION
This script retrieves event ID 1074 from the System log to identify shutdown and reboot events.
It can generate reports for a single server or multiple servers.
.PARAMETER Computer
The target computer name (default: local computer).
@filipnet
filipnet / ADDS_Checks.ps1
Created February 15, 2025 18:10
Active Directory Domain Services (AD DS) Health and User Reports.
<#
.SYNOPSIS
Active Directory Domain Services (AD DS) Health and User Reports.
.DESCRIPTION
This script performs various AD DS health checks, DNS diagnostics, replication status checks,
and extracts domain admin and password expiry reports.
.PARAMETER LogPath
Directory to store log and report files (default: C:\ADDS_Checks).