[英]While creating new mysite in sharepoint set database
Im wondering if there is a way i can tell what database i want the new mysite to be create in. 我想知道是否有办法告诉我要在其中创建新mysite的数据库。
In our server we have multiple databases for mysites SP_MySiteContent00
and SP_MySiteContent01
and so on. 在我们的服务器中,我们有多个数据库用于mysites
SP_MySiteContent00
和SP_MySiteContent01
,依此类推。 But the script below creates them all in SP_MySiteContent
by default. 但是默认情况下,以下脚本在
SP_MySiteContent
全部创建了它们。
Anyone know how can tell what database it should use? 任何人都知道如何分辨应该使用哪个数据库?
This is my code: 这是我的代码:
param
(
[Parameter(Mandatory=$true)]
[string]$username,
[string]$database
)
asnp *sh*
$mysite = (Get-SPSite)[0]
$context = [Microsoft.Office.Server.ServerContext]::GetContext($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"
}
}
It looks like there is no way to specify content databases directly (see: here ), but one possible way to control which content database the new mysite is created in is to set all other content databases to offline mode. 似乎没有办法直接指定内容数据库(请参阅: 此处 ),但是控制创建新mysite的内容数据库的一种可能方法是将所有其他内容数据库设置为脱机模式。
If, for example, the databases you listed above were all you had and you wanted to create a site in "SP_MySiteContent01" you would do: 例如,如果您拥有上面列出的数据库,并且想要在“ SP_MySiteContent01”中创建站点,则可以执行以下操作:
Get-SPContentDatabase “SP_MySiteContent” | Set-SPContentDatabase –Status 1
Get-SPContentDatabase “SP_MySiteContent00” | Set-SPContentDatabase –Status 1
$profile.CreatePersonalSite()
Get-SPContentDatabase “SP_MySiteContent” | Set-SPContentDatabase –Status 0
Get-SPContentDatabase “SP_MySiteContent00” | Set-SPContentDatabase –Status 0
Also see Setting ShaerPoint content databases offline via Script 另请参阅通过脚本将ShaerPoint内容数据库设置为脱机
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.