I tried to use predefined variables like $PSVersionTable or $PSScriptRoot in a class method. They failed with the error message
Variable is not assigned in the method.
Example:
Class Foo { [String]$Version GetVersion() { If ($PSVersionTable) { $this.Version = $PSVersionTable.PSVersion } } } But why?