0

I am trying to automatically install and activate a solution to our Project Server 2019.

I have already installed the solution with Install-PnPSolution, but I cannot activate the feature.

When I activate the feature by hand, I can use Disable-PnPFeature to deactivate the feature again. When I do the same with Enable-PnPFeature, the feature does not get activated.

I suspect that it has got something to do with the ID of the solution. When I activate the feature by hand, I can have it listed with Get-PnPFeature. In this case the GUID of the feature is not the same as during installation.

Unfortunately, I have not found a way to get a list of installed but deactivated features.

How can I get a list of the installed but deactivated features?
What else could cause the feature not being activated?

Here the code:

Connect-PnPOnline -Url $siteUrl -Credentials $cred
Install-PnPSolution -SourceFilePath $solutionPath -PackageId $solutionId
Invoke-PnPQuery
Enable-PnPFeature -Identity $solutionId
1

I got it working now.

There were two problems. The first was that the Solution ID and the Feature ID are not the same. The second that the sandbox flag was not set, although I am trying to install a sandboxed solution. After passing it the feature ID instead of the solution ID and setting the Sandboxed switch it worked like a charm.

Connect-PnPOnline -Url $siteUrl -Credentials $cred
Install-PnPSolution -SourceFilePath $solutionPath -PackageId $solutionId
Invoke-PnPQuery
Enable-PnPFeature -Identity $featureId -Sandboxed

Unfortunately, I have not found a solution to get a list of the deactivated features remotely.

0

The PnP command can only get activated features in the SharePoint sites, you can use Get-SPFeature command.

Check the post: Get list of all features (installed and not active) on site? Trying to use FeatureDefinitions?

  • Thanks for the help, but the Get-SPFeature is only available on the server. The script has to work remote. – redleo85 Sep 19 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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