Consider this simple code:
$myObject = New-Object PSCustomObject
$myObject | Add-Member -MemberType ScriptMethod -Name 'Multiply' -Value { $x=Read-Host; $x = $x * 10; Write-Host "$x" }
$myObject.Multiply()
Entering 1 returns 1111111111 but I would expect the value to be 10.
What is wrong?