1

Weirdly, in one of my script I am trying to do such a call:

Get-Package -Path "c:\inetpub\wwwroot\Platform.dev.local\App_Data\packages\This.File.Was.JustCreated.xml"

but what I get in return is:

Get-Package : A parameter cannot be found that matches parameter name 'Path'.

Given XML file does exist. Moreover, that same script should have access to it as it was that script itself who generated this file on the previous step.

Why so?

The documentation is confusing: it says that Get-Package "Loads the package definition (xml) from the specified path." but the demo shows that it is trying to get from an item. In any case, the error is unable to get a parameter value.

closed as off-topic by Richard Seal May 13 at 18:49

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Richard Seal
If this question can be reworded to fit the rules in the help center, please edit the question.

-1

The right way of calling is without -Path parameter at all:

Get-Package "This.File.Was.JustCreated.xml"

That means, documentation should be corrected, as it claims -Path parameter is mandatory, while it is not, plus the rest of things from my initial question

  • @rich_seal Thank you for the precise answer in Slack, that actually sorted this out! – Martin Miles May 13 at 17:59
  • The documentation is correct in that the parameter is required. While this is a positional parameter, I always recommend you keep the parameter name shown. The reason it broke is not yet known; the issue appears to be related to using the full path. – Michael West May 13 at 18:35
  • Why does it then work without a parameter (as I stated in my answer) and does not work when specifying, also why does parameter require item path rather than xml file? Seriously, it is confusing – Martin Miles May 14 at 8:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.