Public/Get-StrictMode.ps1
function DoIt($p1, $p2) { return $p1 + $p2 } <# .DESCRIPTION 1.0 Prohibits references to uninitialized variables, except for uninitialized variables in strings. 2.0 Prohibits references to uninitialized variables. This includes uninitialized variables in strings. Prohibits references to non-existent properties of an object. Prohibits function calls that use the syntax for calling methods. 3.0 Prohibits references to uninitialized variables. This includes uninitialized variables in strings. Prohibits references to non-existent properties of an object. Prohibits function calls that use the syntax for calling methods. Prohibit out of bounds or unresolvable array indexes. #> function Get-StrictMode { [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingEmptyCatchBlock','')] [CmdletBinding()] param () try { [version]$StrictModeVersion = '3.0' $V3 = 1..3 $null -eq $v3[3] | Out-Null $StrictModeVersion = '2.0' "Inhalt: $V2" | Out-Null $null -eq "I am".EMail | Out-Null DoIt(10, 20) | Out-Null $StrictModeVersion = '1.0' $V1 -gt 5 | Out-Null $StrictModeVersion = "0.0" } catch { } finally { $StrictModeVersion Remove-Item -Path 'function:\DoIt', 'variable:\V1', 'variable:\V2', 'variable:\V3', 'variable:\StrictModeVersion' -Force -ErrorAction Ignore } } # SIG # Begin signature block # MIIcYgYJKoZIhvcNAQcCoIIcUzCCHE8CAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAgx4nLiR7OTCT6 # ryE3mipjv7uYUv+ldiNcFIN2YsNuDqCCFn0wggNyMIICWqADAgECAhA8emkJ82H0 # pEx+itPRny0WMA0GCSqGSIb3DQEBDQUAMFExIzAhBgkqhkiG9w0BCQEWFGluZm9A # YXR0aWxha3JpY2suY29tMSowKAYDVQQDDCFBdHRpbGEgS3JpY2sgKFNvZnR3YXJl # IERldmVsb3BlcikwHhcNMjIxMDE2MTg1MTA3WhcNMzIxMDE2MTkwMTA3WjBRMSMw # IQYJKo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