# encoding: ascii
# api: powershell
# title: ScriptMethod Example
# description: An example of a script method with mandatory parameters
# version: 0.1
# type: script
# author: Joel Bennett
# license: CC0
# x-poshcode-id: 3718
# x-archived: 2012-10-30T23:30:49
# x-published: 2012-10-29T10:51:00
#
#
$x = New-Object PSObject | 
      Add-Member -MemberType ScriptMethod -Name Test -Value {
          param($message=$(Read-Host "Message")) 
          return "This is the message: $message"
      } -Passthru

# You should now call $x.Test("Hello World")
# But if you call $x.Test() it will prompt you for the $message value
