雖然我試圖通過PowerShell創建一個「mysite」,但遇到了一個我很難找到答案的錯誤。通過PowerShell創建「mysite」拋出錯誤
這是錯誤我得到:
新對象:異常調用 「.ctor」 與 「1」 的說法(S):「UserProfileApplicationNotAvailableException_Logging :: UserProfileApplicationProxy.ApplicationProperties ProfilePropertyCache沒有c05da7c0-D405 -4655-a7fa-08e271f4174d」
這是我的PS代碼:
param
(
[Parameter(Mandatory=$true)]
[string]$username
)
asnp *sh*
$mysite = Get-SPSite "http://mysite.dev.loc"
$context = Get-SPServiceContext $mysite
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
#Create user profile
$profile = $upm.ResolveProfile($username)
if(!$profile)
{
Write-Host "$profile does not have a profile. Can't create personal site"
}
elseif($profile)
{
if($profile.PersonalSite -eq $Null)
{
$profile.CreatePersonalSite()
Write-Host "Personal site created"
}
else
{
Write-Warning "$username already has a personal site"
}
}