Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve Details of Deployed Solutions in SharePoint using PowerShell

I need to retrieve the details of all deployed SharePoint solutions, as are displayed in the Central Administration > Operations > Solution Management (AKA the Solution Store), using a PowerShell script (v2.0). Can anyone offer any guidance on how to retrieve this information from the SharePoint solution store via the SharePoint API?

Thanks, MagicAndi.

like image 617
Tangiest Avatar asked Dec 09 '22 17:12

Tangiest


2 Answers

This is actually pretty easy to do. You conect to the SP Farm and just request get_Solutions.

Here is an example:

# Connect to the Farm
$SPfarm = [Microsoft.SharePoint.Administration.SPFarm]::get_Local()

# What Solution are we looking for?
$solution = "sharepointlearningkit.wsp";

# Get the solutions
$currentSolution = $SPfarm.get_Solutions() | Where-Object { $_.DisplayName -eq $solution; }
$currentSolution;
like image 121
Mitchell Skurnik Avatar answered Dec 25 '22 18:12

Mitchell Skurnik


Based on Mitchell's answer, I have used:

    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

    function Get-LocalSPFarm()
    {
       return [Microsoft.SharePoint.Administration.SPFarm]::Local
    }

    function List-Solutions()
    {
        $farm = Get-LocalSPFarm        
        foreach ($solution in $farm.Solutions) 
        {
            Write-Host($solution.DisplayName)
            # Get-Member -InputObject $solution -MemberType property
        }
    }

All credit to Mitchell!

like image 44
Tangiest Avatar answered Dec 25 '22 17:12

Tangiest