Encore un nouveau post dans les PowerShell Series SharePoint 2010.
Aujourd’hui, je présente une manière simple de renommer une collection de site dans la même Application Web et la même base de contenu via un script PowerShell.
Par exemple, renommer http://portal.com/site1 en http://portal.com/site12
Start-SPAssignment -Global
# Section à modifier avec ses propres informations
$WebAppULR = http://portal.com
$SPsiteOldURL = http://portal.com/site1
$SPsiteNewURL = http://portal.com/site12
$Path = C:\temp\site1.bck # chemin de sauvegarde
$JobName = "job-site-deletion"
# Sauvegarde de l'ancienne collection de sites
Backup-SPsite $SPsiteOldURL -path $Path
# Suppression de l'ancienne collection de sites
Remove-SPSite $SPsiteOldURL -Confirm:$false
$WebApp = Get-SPWebApplication $WebAppULR
# Démarrage du Timer Job "Gradual Site Delete"
$job = Get-SPTimerJob | where {$_.Name -eq $JobName -and $_.Parent -eq $WebApp}
Start-SPTimerJob $job
# Restauration de la nouvelle collection de sites
Restore-SPsite $SPsiteNewURL -path $Path -Confirm:$false
Stop-SPAssignment -Global
eNjoy !