Tuesday, May 29, 2012

"Install-SPUserSolution" doesn't accept parameter "Confirm"


Weird.

Based on MSDN ( http://technet.microsoft.com/en-us/library/ff607653 ), PowerShell command "Install-SPUserSolution" has a optional parameter "Confirm". But when I try to run script "Install-SPUserSolution -Identity $solutionName -Site $SiteCollectionUrl -Confirm $false", it prompts me the error below:

Install-SPUserSolution : A positional parameter cannot be found that accepts ar
gument 'False'.
At E:\EricFang\VisualStudio\SPWebPart\MonthFilter\bin\Debug\deploy.reinstall.
pdsha02.ps1:72 char:25
+         Install-SPUserSolution <<<<  -Identity $solutionName -Site $SiteColle
ctionUrl -Confirm $false
    + CategoryInfo          : InvalidArgument: (:) [Install-SPUserSolution], P
   arameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.SharePoint
   .PowerShell.SPCmdletInstallUserSolution

If I remove this parameter from the script, then it works well.

I guess this is a bug. :-)

2 comments:

  1. You're looking for $Confirm:$false.

    ReplyDelete
  2. Hi Michael,

    What I used is "-Confirm $false". I don't think "-$Confirm $false" would work.

    ReplyDelete