I need the url of the mysite in SharePoint 2010 server. In my farm i only have one MySite host (and one corresponding user profile service) configured.

I need the information on one of the farm servers and i'm using powershell for my script.


Using the sharepoint Management Shell you can execute the following script. Replace the url with one of the application url's your are running on:

$mySiteUrl = "http://portal.contoso.com"
$sc = Get-SPServiceContext($mySiteUrl)
$upm = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($sc)

If no url is available take one from Get-SPWebApplication if all web apps are using the same UPS.

| improve this answer | |

For simple farms you can use the following

$upm =  New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager([Microsoft.Office.Server.ServerContext]::Default)
| improve this answer | |

If you are looking for the Personal site for a user profile you can get that from the UserProfileManager.UserProfile.PublicUrl.


| improve this answer | |

If you only have one Web Application in your Server Farm you can also get it this way:

# Get the info from the Content Database
$myContentDb = Get-SPContentDatabase
# Get the Web Application
$myWebApp = Get-SPWebApplication

With these objects you can get the URL and more information on the Web Application. I use this as a precursor to get the information from the Server Farm so I can dismount the content database in preparation for restores in our test environment.

| improve this answer | |

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.