質問

SharePointサーバーで次のPowerShellスクリプトを実行して、新しいホストヘッダーサイトコレクションとテナント管理サイトを作成します。

Add-PSSnapin microsoft.sharepoint.powershell -ea SilentlyContinue

$featurePackID = "23b570e2-61f8-40ca-8e4d-7625ac7a4d37"
$webApplicationURL = "https://myserver"
$url = "https://test.mysharepoint.com" 
$owneralias = "TEST\SP_App01"
$contentDatabase = "WSS_Content_WebApp01"
$template = "STS#0"

$sub = New-SPSiteSubscription

if(!$url.StartsWith("https://")){ $url = "https://$url"; }
if(!$url.StartsWith($webApplicationURL))
{ 
    $hostheader = 'y' 
} 

#Set Feature Pack
if ($featurePackID -ne "")
{
    $FeaturePack = Get-SPSiteSubscriptionFeaturePack $featurePackID
}
if($FeaturePack -ne "" -and $FeaturePack -ne $null){
  Set-SPSiteSubscriptionConfig $sub -FeaturePack $FeaturePack
}

if($hostheader -ieq 'y' -or $hostheader -ieq 'yes'){
  #Pre-Reqs
  if( (Get-SPManagedPath -HostHeader "admin" -ea SilentlyContinue) -eq $null){$void = New-SPManagedPath "admin" -hostheader -explicit}

  $wa = Get-SPWebApplication $webApplicationURL
  New-SPSite $url -owneralias $owneralias -sitesubscription $sub -hostheaderwebapplication $wa -template $template -contentdatabase $contentdatabase #| set-spsite -maxsize 5000000 -warningsize 4000000 
  New-SPSite "$url/admin" -owneralias $owneralias -sitesubscription $sub -template "TENANTADMIN#0" -Administrationsitetype "TenantAdministration" -hostheaderwebapplication $wa -contentdatabase $contentdatabase #| set-spsite -maxsize 5000000 -warningsize 4000000 

}
else{
  New-SPSite $url -owneralias $owneralias -sitesubscription $sub -template "STS#0" | set-spsite -maxsize 5000000 -warningsize 4000000
  New-SPSite "$url/admin" -owneralias $owneralias -sitesubscription $sub -template "TENANTADMIN#0" -Administrationsitetype "TenantAdministration" | set-spsite -maxsize 5000000 -warningsize 400000
}

ただし、次のエラーが発生しています。

new-spsite:オブジェクト参照は、オブジェクトのインスタンスに設定されていません。 + new -spsite <<<< $ url -ounderalias $ owneralias -siteSubscription $ sub -hostheaderwebapplication $ wa -template $ template -contentdata base $ contentDatabase#| set -spsite -maxsize 5000000 -Warningsize 4000000 + categoryInfo:(microsoft.share ... spcmdletnewsite:spcmdletnewsite)[new -spsite]、nullreferenceexception + fully qualifiederrid:microsoft.sharepoint.sharepoint.sherepoint.powerepoint.sherepoint.sharepoint.

何かアイデアはなぜですか?

役に立ちましたか?

解決

これは許可エラーであることが判明しました。テンプレートを指定せずにスクリプトを再実行しますが、アカウントをOwnEraliasとして設定します。次に、このスクリプトを実行してテンプレートを設定しました。

Get-SPSite https://test.mysharepoint.com | Set-SPSite -Template "TenantAdmin#0" -Administrationsitetype "TenantAdministration"

そしてちょっとプレスト - すべて機能しています。それから私は入って、所有者を喜んで変えました。

ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top