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.


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

| improve this answer | |
  • @rich_seal Thank you for the precise answer in Slack, that actually sorted this out! – Martin Miles May 13 '19 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 '19 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 '19 at 8:30

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