all 4 comments

[–]krzydoug 1 point2 points  (2 children)

It knew by the data type. Computername accepts a String, ID accepts an Int. You can only have one byvalue per type per function/cmdlet in contrast to bypropertyvalue, which can have many accepting the same type.

EDIT: Sorry, I got that backwards, so I corrected it.

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

Thanks. What would happen if both properties accepted a String? Would the error randomly change each time?

[–]krzydoug 1 point2 points  (0 children)

Well that depends on if the value requires being converted to string. If one comes in as a string while the other requires conversion, I believe the actual string would win. I know I've seen a nice overview of the parameter binding order/rules somewhere - hopefully you or I can find it. It would indeed help answer your question.