SPO Site rename

Occasional Reader

Hi all,

 

I am looking for a way to rename a SharePoint site but only the site name (I don't want the URL changed). I have found scripts to rename the site title but not the actual name.

 

I have tried scripts to rename the connected M365 group, but that only updates the site name under basic info, but does not update the name under site info.

 

Interestingly if i update the name of thew group manually in the admin center, it updates correctly in SPO (but doesn't update the name under basic info).

 

These are the properties I am looking to update

 

Untitled.png

 

I am needing to prefix over a thousand sites so I really need to find a way to do this in PowerShell or even Graph API.

7 Replies

@daivea 

Powershell:

 

$url="https://<tenant>.sharepoint.com/sites/samplesite"
$newTitle="New Title"
Start-SPOSiteRename -Identity $url -NewSiteTitle $newTitle

 

 

PnP:

 

$SiteURL = "https://contoso.sharepoint.com/coolsite"
  
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
 
#sharepoint online powershell change site name
Set-PnPWeb -Title "Coller Site Portal"

 

 

Thanks, but I don't want the URL changed. Is there no way to do this without changing the URL?
If I use your second example, all that does is change the title within the site. I am looking to change the name of the site in the admin center

@daivea82

Both commands will just change the name, even in admin. That's mirrored

https://pnp.github.io/powershell/cmdlets/Set-PnPWeb.html#-title

 

@NicolasKheirallah 

 

Your command still wants to create a new URL

 

daivea82_0-1719875728739.png


If i do that and specify a new URL, it works as described. But i don't want the URL changed

 

daivea82_1-1719875955644.png


daivea82_2-1719875996979.png

 

 

You can just add the existing URL, it should work!

Else use:

Set-SPOSite -Title "New site title"

@NicolasKheirallah 

 

So it doesn't work as you have described (at least not for me). Maybe I am doing something wrong?

 

The site before changes:

 

daivea82_0-1719966448183.png

 

I set the current and new URL the same but get an error:

 

daivea82_1-1719966523877.png

 

Only if i set the URL to be different does it go through:

 

daivea82_2-1719966591444.png

 

Then it updates the site name:

 

daivea82_3-1719966620720.png

 

Then if i try changing just the title as you have suggested, it still asks me for a new URL and if i specify the current one it fails:

 

daivea82_4-1719966717130.png

 

Also changing the title only changes the title within the site (not in the admin center as the display\site name)