Zum Inhalt
Kaffeeundcode
Skriptbibliothek
PowerShell 06.10.2026

PowerShell

Log Activity

92_Log-Activity.ps1

<#
.SYNOPSIS
    Einfache Logging-Funktion.

.DESCRIPTION
    <!-- library-status:start -->
    Prüfstatus: Ungeprüft
    Windows- und Tenant-Abnahme ausstehend; keine pauschale Produktionsfreigabe.

    <!-- library-status:end -->

    Schreibt Text in eine lokale Logdatei mit Zeitstempel.

.NOTES
    File Name: 92_Log-Activity.ps1
    Author: Mattia Cirillo
    Version: 1.0
#>

param (
    [string]$Message,
    [string]$LogFile = "$HOME/Desktop/ScriptLog.txt"
)

$Line = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - $Message"
Add-Content -Path $LogFile -Value $Line
Write-Host "Log: $Line"