This windows-scripts repository contains various scripts for configuring and maintaining Windows workstations and servers.
- Target environment: Windows 11 and Windows Server 2025, unless specified otherwise.
- New code should be compatible with both PowerShell 7 and PowerShell 5.1.
- Scripts and functions should provide comment-based help, at least
.SYNOPSIS. - Define types for function parameters and return values where possible.
- Keep the encoding and line endings as cloned by
git(CRLF on Windows). - Use
Show-OutputandShow-InformationfromUtils.ps1instead ofWrite-Host. Note thatShow-Outputwrites to the output stream, so useShow-Informationinside functions that return a value.
The scripts are linted with PSScriptAnalyzer,
configured in PSScriptAnalyzerSettings.psd1. Run it locally with:
pwsh ./Invoke-Lint.ps1
It installs PSScriptAnalyzer for the current user if it is missing. Apply the automatic formatting fixes with:
pwsh ./Invoke-Lint.ps1 -Fix
New code should produce no findings at all. The build fails only on Error findings,
since the older scripts still have known warnings. Raise the threshold with
-FailOn Warning once those have been cleaned up.
The CI workflow runs the same script, so a clean local run means a clean CI run.