zoukankan      html  css  js  c++  java
  • SharePoint2010 PowerShell backup restore deploy .WSP

    backup

    复制代码
    # Check to ensure Microsoft.SharePoint.PowerShell is loaded
    $Snapin = get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
    if($Snapin -eq $null){
        Write-host "Loading SharePoint Powershell Snapin"
        Add-PSSnapin "Microsoft.SharePoint.Powershell"
    }
    
    $siteName = "http://SP:999"
    $path = "C:\site_name_999_test.bak"
    
    Write-Host "Starting backup SPSite " $siteName ",please waiting......" -foregroundcolor yellow
    Backup-SPSite $siteName  -Path $path -Force
    Write-Host "Backup SPSite " $siteName "sucessful!" -foregroundcolor green
    复制代码

    restore

    复制代码
    # Check to ensure Microsoft.SharePoint.PowerShell is loaded
    $Snapin = get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
    if($Snapin -eq $null){
        Write-host "Loading SharePoint Powershell Snapin"
        Add-PSSnapin "Microsoft.SharePoint.Powershell"
    }
    
    $siteName = "http://SP:666"
    $path = "C:\Project_201208231718.bak"
    
    Write-Host "Starting resotre SPSite " $siteName ",please waiting......" -foregroundcolor yellow
    Restore-SPSite $siteName  -Path $path -Force
    Write-Host "Restore SPSite " $siteName "sucessful!" -foregroundcolor green
    复制代码

    deploy

    复制代码
    # Check to ensure Microsoft.SharePoint.PowerShell is loaded
    $Snapin = get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
    if($Snapin -eq $null){
        Write-host "Loading SharePoint Powershell Snapin"
        Add-PSSnapin "Microsoft.SharePoint.Powershell"
    }
    
    
    $solutionPortalPath = "C:\aa.wsp"
    $solutionVendorPath = "C:\bb.wsp"
    
    $solutionPortal = "aa.wsp"
    $solutionVendor = "bb.wsp"
    
    # Add SPSolution 
    Write-Host "Starting Add Solution,please waiting......" -foregroundcolor yellow
    Add-SPSolution $solutionPortalPath
    Add-SPSolution $solutionVendorPath
    Write-Host "Solution Add Sucessful!" -foregroundcolor green
    
    # Deploy Solution
    Install-SPSolution –Identity SharePoint2010Solution.wsp –WebApplication http://myserver –GACDeployment
    
    # Deploy  Sandbox Solution
    Install-SPUserSolution –Identity SharePoint2010Solution.wsp     –WebApplication http://myserver  –GACDeployment
    
    # Update Solution Package
    Write-Host "Starting Update Solution,please waiting......" -foregroundcolor yellow
    Update-SPSolution –Identity $solutionPortal –LiteralPath $solutionPortalPath –GacDeployment
    Update-SPSolution –Identity $solutionVendor –LiteralPath $solutionVendorPath –GacDeployment
    Write-Host "Solution Update Sucessful!" -foregroundcolor green
    
    # Uninstall Solution Package
    Uninstall-SPSolution –Identity MySharePointSolution.wsp –WebApplication  http://myserver
    
    # Remove Solution Package
    Remove-SPSolution–Identity MySharePointSolution.wsp

    resource: http://www.cnblogs.com/Fengger/archive/2012/08/24/2654093.html

  • 相关阅读:
    Linux解压bz2文件的方法
    Linux系统解压.tar.gz文件方法
    nginx实现负载均衡
    nginx实现反向代理demo
    spring注解版
    使用poi导入excel中的数据
    springmvc 拦截器
    springmvc之上传文件
    springmvc自定义异常处理器
    springmvc自定义参数转换
  • 原文地址:https://www.cnblogs.com/ilawrence/p/2748279.html
Copyright © 2011-2022 走看看