Creating Personal Sites for Multiple Users present in UPA
I was recently working on this case where I had to create multiple personal sites for users within the UPA application.
I got few articles which helped but did not provide me with the correct script.
A loud shout to my colleague Chanchal on assisting me which eventually helped us with the following PS script that would help us all create personal sites for all the users present in your UPA application.
Since most of us face situations where we need multiple personal sites in your farm during research, i have published this post to assist others as well. I hope this helps all.
$mysiteHostUrl = "http://hulk/my/"
$personalSiteGlobalAdmin = "shptgeek\sharepoint"
$personalSiteGlobalAdminDisplayName = "Personel Site admin"
$mysite = Get-SPSite $mysiteHostUrl
$context = [Microsoft.Office.Server.ServerContext]::GetContext($mysite)
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
$AllProfilesCount = $upm.Count
for($i = 1; $i -lt $AllProfilesCount; $i++)
$profile = $upm.GetUserProfile($i)
$DisplayName = $profile.DisplayName
$AccountName = $profile[[Microsoft.Office.Server.UserProfiles.PropertyConstants]::AccountName].Value
write-host "Personal site does not exist for: " $DisplayName
#Adding an extra admin for personel sites
$pweb = $profile.PersonalSite.OpenWeb()
$padm.IsSiteAdmin = $true;
write-host "Personal Site Admin has assigned"
write-host "Personal site exists for " $DisplayName