In this article you will see how to remove the My Site Host location URL in SharePoint 2010 using PowerShell and the SharePoint object model.
In this article you will see how to remove the My Site Host location URL in SharePoint 2010 using PowerShell and the SharePoint object model. In SharePoint 2010 open the Application Management section in the Central Administration, click on Manage Service Applications. Click on User Profile Service application. Go to My Site Settings, click on Setup My Sites. In that you could see an option "My Site Host" where the My Site Host site collection URL will be added. When you try to remove the URL through UI you will be getting the following error "The URL you entered could not be validated" as shown in the following You could remove the My Site Host URL using Powershell and using SharePoint object model. Remove My Site Host URL using SharePoint object model:
namespace RemoveMySiteHostLocation { class Program { static void Main(string[] args) { using (SPSite site = new SPSite("http://serverName:60001/sites/TestSiteColl")) { SPServiceContext serviceContext = SPServiceContext.GetContext(site); UserProfileManager upm = new UserProfileManager(serviceContext); upm.MySiteHostUrl = ""; } } } }
Remove My Site Host URL using Powershell: Steps Involved: 1. Create the input xml file which contains the inputs to remove My Site Host Location URL. 2. Create ps1 file which contains the script to remove My Site Host Location URL. RemoveMySiteHostURL.xml <?xml version="1.0" encoding="utf-8" ?> <RemoveMySiteHostURL> <SiteURL> http://serverName.com/Finance/Finance/</SiteURL> </RemoveMySiteHostURL> RemoveMySiteHostURL.ps1 ## ------------------------------------------------------------------- ## Powershell script to remove My Site Host URL ## Note : Need to update the XML file path before running the script. ## Author : Vijai Anand Ramalingam ## Date : 28-Oct-2011 ## -------------------------------------------------------------------
#----------------Get the xml file---------------------------------------------------------------
[xml]$xmlData=Get-Content "D:\VijaiPOC\RemoveMySiteHostURL.xml"
#----------------Remove My Site Host URL function----------------------------------------------------
function RemoveMySiteHostURL() {
$site = Get-SPSite $xmlData.RemoveMySiteHostURL.SiteURL
## Get the context of the service application $context = Get-SPServiceContext($site)
$upm = New-Object -TypeName Microsoft.Office.Server.UserProfiles.UserProfileManager -ArgumentList $context $upm.MySiteHostURL=""; }
#----------------Calling the function------------------------------------------------------------
RemoveMySiteHostURL Run the Script:
Go to Start.
Click on All Programs.
Click on Microsoft SharePoint 2010 Products and then click on SharePoint 2010 Management Shell (run as Administrator).
Run the D:\VijaiPOC\RemoveMySiteHostURL.ps1
Thus in this article you have seen how to remove My Site Host URL in SharePoint 2010 using Powershell and SharePoint object model
Getting Started with Managed Metadata Service in SharePoint 2010