powershell 这将复制SharePoint网站。首先使用原始网站使用的相同模板制作空白网站。如果templa,这将失败
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 这将复制SharePoint网站。首先使用原始网站使用的相同模板制作空白网站。如果templa,这将失败相关的知识,希望对你有一定的参考价值。
##Backup and then imports a list, watch out for the paths
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
##<SiteURL> is URL for the site, list, or library that you are exporting.
$SourceWebURL = "http://scushp01/IT"
$SourceListURL = "/IT/Lists/SiteLinks"
$BackupPath = "C:\temp\ListB.cmp"
Export-SPweb $SourceWebURL -IncludeVersions All -ItemUrl $SourceListURL -path ($BackupPath) -nologfile -Force
$TargetWebURL = "http://scushp01/HR/Surveys"
import-spweb $TargetWebURL -IncludeUserSecurity -path ($BackupPath) -nologfile -UpdateVersions Overwrite
##Backup a list
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
##<SiteURL> is URL for the site, list, or library that you are exporting.
$SourceWebURL = "http://scushp01/sites/Testing/IT/Main"
$SourceListURL = "/sites/Testing/IT/Main/Lists/Links"
$BackupPath = "C:\temp\"
Export-SPweb $SourceWebURL -IncludeVersions All -ItemUrl $SourceListURL -path ($BackupPath + "NetTracking.cmp") -nologfile -Force
##add the main backup site to the main site.
Add-PSSnapin Microsoft.SharePoint.PowerShell
$TargetWebURL = "http://scushp01/sites/Testing/IT/main"
$BackupPath = "C:\temp\ITMainSite\main"
import-spweb $TargetWebURL -IncludeUserSecurity -path ($BackupPath + ".cmp") -nologfile -UpdateVersions Overwrite
##Backup a list
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
##<SiteURL> is URL for the site, list, or library that you are exporting.
$SourceWebURL = "http://portal.opwftg.com/sites/OPWSS/HR"
$SourceListURL = "/sites/OPWSS/HR/Team"
$BackupPath = "E:\temp\"
Export-SPweb $SourceWebURL -IncludeVersions All -ItemUrl $SourceListURL -path ($BackupPath + "xx.cmp") -nologfile -Force
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction Stop
try{
$web = Get-SPWeb http://portal.opwftg.com/sites/OPWSS/Teams/Safety/SiteTemplate/Cells
write-host “Web Template:” $web.WebTemplate ” | Web Template ID:” $web.WebTemplateId
$template = $web.WebTemplate
$TargetWebURL1 = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/FCS/Cells"
$newWeb = New-SPWeb -Url $TargetWebURL1 -Name 'Cells'
$newWeb.ApplyWebTemplate($template)
write-host 'Created 1'
$SourceWebURL = "http://portal.opwftg.com/sites/OPWSS/Teams/Safety/SiteTemplate/Cells"
$BackupPath = "E:\temp\TempSave"
Export-SPweb $SourceWebURL -IncludeUserSecurity -IncludeVersions All -path ($BackupPath + ".cmp") -nologfile -Force
import-spweb $TargetWebURL1 -IncludeUserSecurity -path ($BackupPath + ".cmp") -nologfile -UpdateVersions Overwrite
write-host 'Imported 1'
}
catch{
"Something strange occurred: $_"
}
##http://technet.microsoft.com/en-us/library/ee428301(v=office.15).aspx
##Export site and then import the site
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Get the Source site
##<SiteURL> is URL for the site, list, or library that you are exporting.
$SourceWebURL = "http://portal.opwftg.com/teamsites/it/OCM"
$BackupPath = "E:\temp\TempSave"
$TargetWebURL = "http://portal.opwftg.com/teamsites/it/GD"
Export-SPweb $SourceWebURL -IncludeUserSecurity -IncludeVersions All -path ($BackupPath + ".cmp") -nologfile -Force
#Import the List to Target Web
import-spweb $TargetWebURL -IncludeUserSecurity -path ($BackupPath + ".cmp") -nologfile -UpdateVersions Overwrite
##########################################################################
##Backup a list
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
##<SiteURL> is URL for the site, list, or library that you are exporting.
$SourceWebURL = "http://opwshp02/oracle"
$SourceListURL = "/oracle/Lists/Oracle Super Users/Allitems.aspx"
$BackupPath = "E:\temp\TempSave\"
Export-SPweb $SourceWebURL -IncludeVersions All -ItemUrl $SourceListURL -path ($BackupPath + "OracleSuperUsers.cmp") -nologfile -Force
##This also worked for a list
##Backup a list
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
##<SiteURL> is URL for the site, list, or library that you are exporting.
$SourceWebURL = "http://portal.opwftg.com/teamsites/it/GD"
$SourceListURL = "/teamsites/it/GD/Lists/R12%20Issue%20Tracker/Open%20Issues.aspx"
$BackupPath = "E:\temp\TempSave\"
Export-SPweb $SourceWebURL -IncludeVersions All -ItemUrl $SourceListURL -path ($BackupPath + "xx.cmp") -nologfile -Force
#############Import the backuped up list#################
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$BackupPath = "E:\temp\TempSave\Intranet"
$TargetWebURL = "http://portal.opwftg.com/sites/OPWSS/Testing/TestLibraryMigration"
import-spweb $TargetWebURL -IncludeUserSecurity -path ($BackupPath + "OracleSuperUsers.cmp") -nologfile -UpdateVersions Overwrite
以上是关于powershell 这将复制SharePoint网站。首先使用原始网站使用的相同模板制作空白网站。如果templa,这将失败的主要内容,如果未能解决你的问题,请参考以下文章