When I run the following script, I get a The variable '$windowHeight' cannot be retrieved because it has not been set. error message.
set-strictMode -version 2
param (
[parameter(Mandatory=$false)] [Int32] $windowHeight,
[parameter(Mandatory=$false)] [Int32] $windowWidth
)
echo "windowHeight: $windowHeight"
echo "windowWidth: $windowWidth"
This error message goes away if I remove the set-strictMode statement.
Is it somehow possible to use set-strictMode -version 2 together with the param statement, without getting an error message?