문제

한 SharePoint 2010 팜에서 다른 SharePoint 2010 Farm에서 다른 SharePoint 2010에서 마이그레이션하려고합니다.이미 WSP 파일을 새 팜의 폴더에 복사했습니다.

폴더의 경로를 입력으로 취하고 폴더에있는 모든 WSP를 팜에 추가 할 수있는 PowerShell 스크립트가 필요합니다.나는 그들을 농장에 추가하기를 바꾸고 싶지 않다.

입력 예 : -

c : \ exportedwsp

도움이 되었습니까?

해결책

WSP가있는 폴더의 경로를 제공하고 함수는 솔루션 저장소에 모든 WSP를 추가합니다.

Remove-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
function WaitForInsallation([string] $Name)
{
        Write-Host -NoNewline "Waiting for deployment job to complete" $Name "."
        $wspSol = get-SpSolution $Name
        while($wspSol.JobExists)
        {
            sleep 2
            Write-Host -NoNewline "."
            $wspSol = get-SpSolution $Name
        }
        Write-Host "job ended" -ForegroundColor green
}
Function Deploy-SPSolution ($WspFolderPath)
{
    $wspFiles = get-childitem $WspFolderPath | where {$_.Name -like "*.wsp"}

    ForEach($file in $wspFiles)
    {
        $wsp = Get-SPSolution | Where{$_.Name -eq $file.Name}
        if($wsp -eq $null)
        {
            write-host "Adding solution"
            Add-SPSolution -LiteralPath ($WspFolderPath + "\" + $file.Name)
        }
        else
        {
            write-host "solution already exists"

        }

    }
}
try
{
        Deploy-SPSolution "C:\EXPORTEDWSP"
}
catch
{
    write-host $_.exception

}
.

다른 팁

깨끗한 팜에서만 WSP가있는 폴더가있는 경우 스크립트를 단축 할 수 있습니다 :

$names = get-childitem F:\SPProdSolutionsExtract
foreach ($solution in $names) {Add-SPSolution -LiteralPath ("F:\SPProdSolutionsExtract\" + $solution.Name) }
.

SharePoint 팜 솔루션 추출기를 사용하여 하나의 서버에서 WSP와 위의 스크립트를 팜에 추가 할 수 있습니다.WSP 및 매개 변수가 많은 유형이 너무 많기 때문에 설치 솔루션 스크립트가 더 많은 작업입니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top