Missing Personal site url in user profile properties after editing filters in ups connection - mysite - powershell
-
06-10-2020 - |
Вопрос
Something strange has happend in my environment. I've pre-populated 1500 user profiles and everything was ok. After some changes with the connections filters in user profile synchronization connection it seams that every users has got their personal site url deleted in their user properties.
Question 1: Is there a way to update every user profile with their "Personal site" url? (timerjob / cleanup .. )
I'm trying to run a script to update every user profile but when I try to update the field I get that the property are "read-only".
foreach($profile in $AllProfiles)
{
$DisplayName = $profile.DisplayName
$AccountName = $profile[[Microsoft.Office.Server.UserProfiles.PropertyConstants]::AccountName].Value
Try
#$time = Get-Date -Format HH:mm:ss
if($profile.PersonalSite -eq $Null)
{
$person = $AccountName.Substring(7)
$personalSite = Get-SPSite $profilFullURL"/personal/"$person
if($personalSite)
{
Write-Host $time" $x updating personal site in profile:"$person -NoNewline
$profile.PersonalSite = $personalSite.Url
$profile.Commit()
Write-Host " Done" -ForegroundColor Green
$x++
}
Question 2: how do I update personalsite ? (read-only)
Решение
I found the answer for updating the field.. Had to use
$profile["PersonalSpace"].Value = "/personal/"+$person
Remember to have a url that starts with "/personal/"
Не связан с sharepoint.stackexchange