SharePoint: How do I get the location of the MySite url using PowerShell?
[void][reflection.assembly]::Loadwithpartialname("Microsoft.Office.Server");
[void][reflection.assembly]::Loadwithpartialname("Microsoft.Office.Server.UserProfiles");
[void][reflection.assembly]::Loadwithpartialname("System.Web");
[void][reflection.assembly]::Loadwithpartialname("Microsoft.SharePoint");
$mySiteUrl = "http://mysitecollection.com"
$sc = Get-SPServiceContext($mySiteUrl)
$upm = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($sc)
Write-Host $upm.MySiteHostUrl
NOTE: If you encounter a 'Permission Denied' error, make sure that your user has 'Full Control' permissions on the User Profile Service.
[void][reflection.assembly]::Loadwithpartialname("Microsoft.Office.Server.UserProfiles");
[void][reflection.assembly]::Loadwithpartialname("System.Web");
[void][reflection.assembly]::Loadwithpartialname("Microsoft.SharePoint");
$mySiteUrl = "http://mysitecollection.com"
$sc = Get-SPServiceContext($mySiteUrl)
$upm = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($sc)
Write-Host $upm.MySiteHostUrl
NOTE: If you encounter a 'Permission Denied' error, make sure that your user has 'Full Control' permissions on the User Profile Service.
Comments
Post a Comment