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>

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?

1 Answer 1


Todd Klindt suggests the following

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

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, 2017 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.