Wird mit PowerShell über Get-Date das aktuelle Datum abgefragt nutzt PowerShell die regionalen Einstellungen von Windows.

Die Einstellungen lassen sich mit PowerShell über Get-Culture auswerten und in den Regionaleinstellungen von Windows sind die detaillierten Formate abgebildet.

Nun möchte ich eine deutsche Bezeichung ausgeben.
Get-Date -Format "dddd, dd.MM.yyyy" OR
Get-Date -Format "dddd, dd. MMMM yyyy"
Durch meine englische Konfiguration stimmt die Bezeichnung für Wochentag/Monat nicht.

Statt die Regionaleinstellungen anzupassen kann ich PowerShell mitgeben welche Sprache es (einmalig) nutzen soll.
- Für den Wochentag
$RegionalCulture = New-Object System.Globalization.CultureInfo("de-CH")
$DayName = $RegionalCulture.DateTimeFormat.GetDayName((Get-Date).DayOfWeek)
$Date = ("$DayName, " + (Get-Date -format "dd.MM.yyyy"))
$RegionalCulture.TextInfo.ToTitleCase($Date) # to capitalize the first character of the day

- Für Wochentag und Monat
Mit ein wenig Zusatz passt es den Monatsnamen ebenfalls auf die deutsche Bezeichnung an.
$RegionalCulture = New-Object System.Globalization.CultureInfo("de-CH")
$DayName = $RegionalCulture.DateTimeFormat.GetDayName((Get-Date).DayOfWeek)
$MonthName = $RegionalCulture.DateTimeFormat.GetMonthName(((Get-Date).Month))
$Date = ("$DayName, " + (Get-Date -format "dd. MMMMM yyyy")).Replace((Get-Date -format MMMM),$MonthName)
$RegionalCulture.TextInfo.ToTitleCase($Date) # to capitalize the first character of day and month

Durch die einmalige Anpassung der Sprache kann es auf viele Sprachen verändert werden. Die regionalen Sprachcodes listet Microsoft unter anderem hier. Für die Schweiz unterstützt es auch Rätoromanisch.
$RegionalCulture = New-Object System.Globalization.CultureInfo("rm-CH")
$DayName = $RegionalCulture.DateTimeFormat.GetDayName((Get-Date).DayOfWeek)
$MonthName = $RegionalCulture.DateTimeFormat.GetMonthName(((Get-Date).Month))
$Date = ("$DayName, " + (Get-Date -format "dd. MMMMM yyyy")).Replace((Get-Date -format MMMM),$MonthName)
$RegionalCulture.TextInfo.ToTitleCase($Date) # to capitalize the first character of day and month
