我需要检索所有已部署的SharePoint解决方案的详细信息,如管理中心>中所示。操作>解决方案管理(AKA解决方案存储),使用PowerShell脚本(v2.0)。任何人都可以提供有关如何通过SharePoint API从SharePoint解决方案商店检索此信息的任何指导吗?
谢谢,MagicAndi。
答案 0 :(得分:8)
这实际上很容易做到。您连接到SP Farm并请求获取解决方案。
以下是一个例子:
# 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;
答案 1 :(得分:3)
根据Mitchell's answer,我使用了:
[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
}
}
归功于米切尔!
答案 2 :(得分:2)
您可以从您的powershell脚本中调用stsadm.exe -o enumsolutions
。它返回XML数据,您可以轻松地将其转换为[xml]
数据类型,并从中查看您需要的任何内容
(stsadm住在c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin
)
输出包含与此
类似的语句<Solution Name="yoursolution.wsp">
<Id>ab693dcd-6483-45ad-abba-9c996c67b6e0</Id>
<File>yoursolution.wsp</File>
<Deployed>TRUE</Deployed>
<WebApplicationSpecific>TRUE</WebApplicationSpecific>
<ContainsGlobalAssembly>TRUE</ContainsGlobalAssembly>
<ContainsCodeAccessSecurityPolicy>FALSE</ContainsCodeAccessSecurityPolicy>
<Deployment WebApplication="http://devserver/" />
<LastOperationResult>DeploymentSucceeded</LastOperationResult>
<LastOperationTime>10/26/2009 9:06 AM</LastOperationTime>
</Solution>
答案 3 :(得分:1)
以下是我用来提取解决方案信息的三个powershell cmdlet。与上面的相比,我很简单,但我认为无论如何我都会提交它们:)
在SP2010 Management Shell中
Get-spsolutions
get-spsolution -identity |选择*
get-spsolution |选择* | out-file c:\ solutions.txt