Renaming Site Collections#

Renaming Site Collections is not a difficult task at all as stsadm has a command called renamesites:

stsadm.exe -o renamesite -oldurl http://sharepointsite.com/sites/john -newurl "http://sharepointsite.com/sites/john55"

.....but without installing the hotfix http://support.microsoft.com/kb/939535 to enable it your stuck with the tried and tested approach of backing up a site collection, deleting the site collection and then restoring the backed up collection to a new site.  A simple enough task in itself but clearly carries some risk.  The mitigating factor of course is that should it all go pear shaped, at least you have a backup.

Anyway, here are a couple of simple batch files to help you rename a site using either approach:

The first uses traditonal backup and delete technique.

@ECHO BEFORE YOU RUN THIS BATCH BE ABSOLUTELY SURE THAT THE NEW NAME CHOICE FOR THE SITE COLLECTION DOES NOT ALREADY EXIST
PAUSE
SET PATH=%PATH%;"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\"
stsadm.exe -o backup -url http://sharepointsite.com/sites/changed -overwrite -filename c:\siterename\backup.dat
@ECHO Completed BACKUP
stsadm.exe -o deletesite -url http://sharepointsite.com/sites/changemetest
@ECHO Completed DELETION
stsadm.exe" -o restore -url http://sharepointsite.com/sites/changed -filename c:\siterename\backup.dat
@ECHO Completed RESTORE with new name
Pause

The second uses renameweb

@ECHO BEFORE YOU RUN THIS BATCH BE ABSOLUTELY SURE THAT THE NEW NAME CHOICE FOR THE SITE COLLECTION DOES NOT ALREADY EXIST
@ECHO Requires HOTFIX 939592
PAUSE
SET PATH=%PATH%;"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\"
stsadm.exe -o renamesite -oldurl "http://sharepointsite.com/sites/john" -newurl "http://sharepointsite.com/sites/john55"
@ECHO Completed rename
Pause

If you do rename a site collection any existing alerts that were setup in that collection are unlikely to continue working as the alert was for a different URL than the one you have moved your collection or site into.

11/7/2007 3:53:25 PM (GMT Standard Time, UTC+00:00) #    Comments  |  Trackback

 

All content © 2009, John Timney
On this page
This site
Calendar
<January 2009>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567
Archives
Sitemap
Blogroll OPML
Talk to Me

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail