Differences

This shows you the differences between the selected revisions of the page.

faq_library_parameters 2019-03-01 faq_library_parameters 2025-07-26 (current)
Line 3: Line 3:
You are probably passing the options in a wrong order. Particularly, you cannot skip parameters, even if you do not need to use them. You are probably passing the options in a wrong order. Particularly, you cannot skip parameters, even if you do not need to use them.
-For example, you want to call [[library_session_putfiles|''Session.PutFiles'' method]] and you provide the ''[[library_transferoptions|TransferOptions]] options'' parameter. The ''options'' is 4th parameter. Even though the 3rd ''bool remove'' parameter is optional and you are not interested in giving it a non-default value, you have to.+For example, you want to call [[library_session_putfiles|''Session.PutFiles'' method]] and you provide the ''[[library_transferoptions|TransferOptions]] options'' parameter. The ''options'' is 4th parameter. Even though the 3rd ''bool remove'' parameter is optional and you are not interested in giving it a non-default value, you have to (PowerShell does not support passing values to optional parameters by name).
This is the correct call: This is the correct call:
Line 17: Line 17:
</code> </code>
-PowerShell unfortunately does everything it can, to convert an invalid argument to a target parameter type. In this case, it will convert non-null ''$options'' argument to ''$True'', instead of failing.+PowerShell unfortunately does everything it can, to convert an invalid argument to a target parameter type. In this case, it will silently convert non-null ''$options'' argument to ''$True'', instead of failing.

Last modified: by martin