0

I'm trying to rename an SPSite to a URL that had been previously deleted.

So I go like this (note - urls redacted)

$site = get-spsite <mysecondurl>
$site.rename('myfirsturl')

However, when I run this, I'm getting this error.

Exception calling "Rename" with "1" argument(s): "Could not rename this site collection. The URL specified is already in use."

I've gone to Get-SPSite, and the URL I want to rename to is not there. I've gone to Get-SPDeletedSite and it was there so I removed the site using Get-SPRemovedSite.

However, I'm still getting the same error.

Where else should I check to ensure this URL is not being used?

0

Todd Klindt suggests the following

$site = Get-SPSite http://portal.contoso.com/sites/foo
$uri = New-Object System.Uri("http://foo.contoso.com")
$site.Rename($uri)

To get 100% success I have to force the Content Database to refresh its site map with this:

((Get-SPSite http://foo.contoso.com).contentdatabase).RefreshSitesInConfigurationDatabase

and run an IISReset. The IISReset isn’t always necessary, but it’s good to plan for it.

That would seem to include some relevant steps which weren't part of your approach.

  • this didn't work. It was weird, I ended up having to manually delete the URL from the SiteMapURL table. I'm not even sure why it was in there since I had already deleted it – Ippal Jun 20 '17 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.