I have a powershell function, is there any way to convert it into a script method?

```
function Do-Something {
  Param( 
     $p1,
     $p2
     )
 [...]
}

```

I am trying to convert it to script method in below fashion, but it throws exception.

```
$obj | add-member-membertype scriptmethod { $function:Do-Something }

```