Is it possible to create a typed read-only variable/constant in a PowerShell script? Afaik there a two ways to create a variable:
First way:
[int] $myVar1
But I am not aware of any constant / readonly keyword nor any other way to prevent changes from this variable.
Second via Cmdlet:
New-Variable -Name 'myVar1' -Option ReadOnly (editable with -Force) or
New-Variable -Name 'myVar1' -Option Constant
But I don't know any way to apply both. Any ideas?