How to change SharePoint My Site Host Url using Power Shell

$AnySiteCollectionUrl = "http://SPSite/"
$site = Get-SPSite $AnySiteCollectionUrl

$context = Get-SPServiceContext($site)
$pm = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)

Write-Host "previous My Site Host Url: " $pm.MySiteHostUrl -ForegroundColor Yellow;

$pm.MySiteHostUrl = ""
$pm.MySiteHostUrl = "http://mysiteurl/"
Write-Host "new My Site Host Url: " $pm.MySiteHostUrl -ForegroundColor Yellow;

$site.Dispose()

Comments

Popular posts from this blog

How to remove app from SharePoint 2013/2016

The model backing the context has changed since the database was created. Consider using Code First Migrations to update the database