diff --git a/README.md b/README.md index cfc33a41..7c5a6307 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,8 @@ Each PowerShell script should follow the 7 golden rules: * **Rule #4:** provide a metadata header with syntax, description, author, source, and license * **Rule #5:** prefer command-line options, else ask the user * **Rule #6:** the encoding of the script is in UTF-8 with BOM to support Unicode characters -* **Rule #7:** exits 0 for success, else print an error message and exit with the error code (mostly 1) +* **Rule #7:** use 'Set-StrictMode -Version Latest' to enable additional error checking +* **Rule #8:** exits 0 for success, else print an error message and exit with the error code (mostly 1) Feedback -------- diff --git a/Scripts/train-dns-cache.ps1 b/Scripts/train-dns-cache.ps1 index 2ef1b584..210af3b2 100755 --- a/Scripts/train-dns-cache.ps1 +++ b/Scripts/train-dns-cache.ps1 @@ -5,6 +5,8 @@ # Author: Markus Fleschutz # Source: github.com/fleschutz/PowerShell # License: CC0 + +Set-StrictMode -Version Latest try { $StartTime = Get-Date diff --git a/Scripts/write-big.ps1 b/Scripts/write-big.ps1 index 68c0e5eb..fec7ef0f 100755 --- a/Scripts/write-big.ps1 +++ b/Scripts/write-big.ps1 @@ -8,6 +8,8 @@ param([String]$Text) +Set-StrictMode -Version Latest + function BigA() { param([Int]$Row) switch($Row) { 1 { return " __ " }