0

単一のライブ環境でしか作業していないSharepoint開発者から引き継いだところです。

開発環境(およびその後UAT環境)をセットアップしたいので、これを行うには、すべてのサイトコレクション、コンテンツ、および(理想的には)アクセス許可を含む、ライブバージョンの正確な(または可能な限り正確に近い)クローンが必要です。 。

Googleで調べたところ、管理シェルを使用して単一のサイトコレクションをバックアップおよび復元できることがわかりましたが、各コレクションを個別に実行するには非常に時間がかかります。

誰かがこれを行うための信頼できる方法を提案できますか?

4

1 に答える 1

0

スクリプトを作成しないのはなぜですか?ここに私が使用する小さなスクリプトがあります:

[System.Console]::Clear()

write-host "remoting to live environment"

$siteCollectionUrl = "http://live.mysite.com";

if ($args.count -gt 0) {
   $siteCollectionUrl = $args[0]
   write-host "going to pullback content from $siteCollectionUrl"
}

$pwd = Get-Content c:\install\backups\crd-sharepoint.txt | ConvertTo-SecureString

$crd=new-object -typename System.Management.Automation.PSCredential -ArgumentList "dev\svc-sp-setup-dvt", $pwd

$s = New-PSSession -computername "liveServer" -Authentication CredSSP -Credential $crd

Invoke-Command -Session $s -Scriptblock {
param($siteCollectionUrl)
write-host "Connected, activating SharePoint snap-in..."
Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction "SilentlyContinue"

write-host "Backing up $siteCollectionUrl remotely..."
backup-spsite -identity "$siteCollectionUrl" -path "c:\install\backups\scheduled_backup.bak" -force
} -args $siteCollectionUrl
#end session
Remove-PSSession $s

$path = "c:\install\backups\"
write-host "Copy backup locally..."
#copy
copy-item "\\liveServer\c$\install\backups\scheduled_backup.bak" $path -Force

write-host "restore...this may take a while if not already running in SharePoint PowerShell.  your patience is appreciated"
#restore
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue"

restore-spsite -identity "$siteCollectionUrl" -path c:\install\backups\scheduled_backup.bak -force -confirm:$false

$username = [Environment]::UserName

write-host "have a great day, $username"

これには、PowerShell リモート処理を有効にする必要があります。サイトのリストがある場合は、コピーしたいサイト コレクションの URL を指定してこのスクリプトを繰り返し呼び出すことができます。

$scriptPath = Join-Path (get-location) "backup_and_restore.ps1";
& $scriptPath "http://admin.accounting.mycompany.com"
& $scriptPath "http://admin.sales.mycompany.com"
& $scriptPath "http://admin.marketing.mycompany.com"
& $scriptPath "http://admin.engineering.mycompany.com"

または、スクリプトでサイト コレクションごとにバックアップを作成し、それらを同じように復元することもできます。これは、SharePoint スナップインを再起動する必要がないため、劇的に効率的になりますが、状況に応じて何が最適かを判断するのはあなた次第です。

于 2012-12-06T16:09:58.817 に答える