Thursday 22 May 2014

Powershell script to copy content from one site to other site.

$ErrorActionPreference = "Stop"

Add-PSSnapin Microsoft.SharePoint.PowerShell
$SourcesiteCollectionUrl = read-host "Enter the source SiteCollection URL"
$TargetSiteCollectionUrl = read-host "Enter the target SiteCollection URL"
$dataFileName = read-host "Enter the data file name to create in C Drive"
$path = "C:\"+$dataFileName+".dat"
Export-SPWeb -identity $SourcesiteCollectionUrl -path $path

Import-SPWeb -identity $TargetSiteCollectionUrl -path $path

No comments:

Post a Comment