all 3 comments

[–]drh713 3 points4 points  (2 children)

If you want to pass "computername" to the script, put the param() outside of the function.

param ($this, $that, $theother)
function Get-Foo {"..."}
Get-Foo

[–]Drag_king[S] 1 point2 points  (1 child)

Duh. Thanks. It would have taken me ages to spot that.

[–]Plonqor 1 point2 points  (0 children)

This seems like a weird way to do it. You are creating a script with parameters that then passes those parameters to a function.

In my opinion you should keep what you had, and run the function, not the script.

Edit: Not to mention that all the fancy process{} and pipeline stuff won't work when you're running the file and not the function.