PowerShell ile SharePoint'te Alt Site Nasıl Oluşturulur?


Alt site oluşturma, SharePoint Web kullanıcı arayüzünden kolayca yönetilebilse de, SharePoint'te programlı olarak alt siteler oluşturmak için PowerShell cmdlet New-SPWeb'i de kullanabiliriz. Bu, herhangi bir SharePoint 2010/2013 site koleksiyonu altında bir dizi alt site oluşturmanız gerektiğinde veya toplu olarak alt siteler oluşturmanız gerektiğinde Veya SharePoint kullanıcı arayüzü "Boş" bir site oluşturma seçeneği sunmadığında son derece faydalıdır. şablon!

PowerShell'i kullanarak SharePoint'te bir Alt Site Oluşturma

PowerShell'i kullanarak SharePoint'te yeni bir alt site oluşturmanın bir yolunu mu arıyorsunuz? Bu blog gönderisi, SharePoint'te bir alt site oluşturmak için PowerShell'in nasıl kullanılacağını gösterecektir. Ayrıca alt siteniz için başlık ve açıklama gibi belirli ayarları nasıl yapılandıracağınızı da göstereceğiz.


Add-PSSnapin "Microsoft.SharePoint.Powershell" -EA SilentlyContinue

#Define value for Variables
$SiteTitle = "Human Resource"
#URL for you new subsite
$SiteUrl = "https://demo.pccs.com/hr/"
#Templte to be assigned to the subsite
$WebTemplate = "STS#0" #Team Site template

#create subsite using powershell sharepoint 2010/SharePoint 2013
New-SPWeb -Name $SiteTitle -Url $SiteUrl -Template $WebTemplate 

Başarılı bir alt site oluşturulduktan sonra, New-SPWeb cmdlet'i yukarıdaki ekranda olduğu gibi alt site URL'sini döndürmelidir.

Şablon parametresi için herhangi bir değer verilmemişse, alt siteyi ilk kez açtığınızda SharePoint sizden bir web şablonu seçmenizi ister. Yukarıdaki komut dosyası PowerShell kullanarak alt site oluşturmanın daha kolay bir yolunu sağlasa da, PowerShell kullanarak SharePoint 2013'te alt siteler oluştururken izinler, gezinme vb. gibi diğer seçenekleri inceleyelim:


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Variables for site creation
$SiteTitle = "Purchase Portal"

#Site description
$SiteDescription ="Portal for Purchase Department Portal"

#URL for you new subsite
$SiteUrl = "https://intranet.crescent.com/travel/"

#Templte to be assigned to the subsite
$WebTemplate = "STS#0" #Team Site template

# AddToTopNav -  Adds the new site within the top navigation of the site collection
# UseParentTopNav  - Replicates the top navigation of the site collection into the new subsite
# UniquePermissions  - Instructs not to inherit permissions from the site collection

#create subsite using PowerShell SharePoint 2010/SharePoint 2013
New-SPWeb -Name $SiteTitle -Description $SiteDescription -Url $SiteUrl -Template $WebTemplate  -AddToTopNav -UniquePermissions -UseParentTopNav 

İlgili gönderi: SharePoint PowerShell, şablondan yeni alt site oluşturmak için SharePoint 2013 şablondan alt site oluşturma PowerShell

İlgili makaleler