通过 powershell 创建 "mysite" 会抛出错误
Creating "mysite" through powershell throws error
我正在尝试通过 powershell 创建 "mysite",但我 运行 遇到一个错误,我很难找到答案。
这是我得到的错误:
New-Object : Exception calling ".ctor" with "1" argument(s): "UserProfileApplicationNotAvailableException_Logging :: UserProfileApplicationProxy.ApplicationProperties ProfilePropertyCache does not have 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"
}
}
我正在尝试通过 powershell 创建 "mysite",但我 运行 遇到一个错误,我很难找到答案。
这是我得到的错误:
New-Object : Exception calling ".ctor" with "1" argument(s): "UserProfileApplicationNotAvailableException_Logging :: UserProfileApplicationProxy.ApplicationProperties ProfilePropertyCache does not have 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"
}
}