使用PowerShell 创建SharePoint 站点

使用PowerShell 创建SharePoint 站点

        在SharePoint开发中,你应该学会使用PowerShell管理SharePoint网站。SharePoint Management Shell是一个Windows PowerShell模块,你能够用它高效管理SharePoint 用户、网站、网站集和组织。

        这里教你简单的语句,创建一个SharePoint站点。

        输入下面语句。红色框内信息是按下Enter后出现的。

        建立的站点例如以下:

        首先我们须要理解怎样使用PowerShell创建网站。

new-spweb这一特殊命令仅仅有一个必要元素,即网站的URL。可是也有更多參数。在创建网站时使用能够丰富网站信息。

-url:新创建网站的URL。

-template: 加入模板号。
-name: 显示网站名称。

-AddToTopNav: 是否要网站显示在顶部导航栏。
-UseParentTopNav:是否要网站使用父网站的导航。
        经測试,支持汉字站点名称。
        关于SharePoint 2010 网站模板名称与ID的相应,请查看http://blogs.msdn.com/b/richin/archive/2011/07/04/sharepoint-2010-site-template-names.aspx
        假设你不确定哪些模板是可用的。你能够使用Get-SPWebTemplate返回可用模板的列表。

补充

创建新的Web应用程序

New-SPWebApplication -Name <name>-HostHeader <hostheader> Port <port>  -Url<url> -ApplicationPool <application pool> -ApplicationPoolAccount <applicationpoolaccount> –DataBaseName <databasename>
                                                           ------------------------------------切割线----------------------------------------
New-SPWebApplication -Name “Company Intranet” -HostHeader “intranet.company.com”-Port 80 -Url “http://intranet.company.com:80” -ApplicationPool “SharePoint Web Applications” -ApplicationPoolAccount (Get-SPManagedAccount “CompanySP_Service”)  -DatabaseName “WSS_Content_Intranet”

删除Web应用程序

Remove-SPWebApplication http://intranet.company.com -DeleteIISSite -RemoveContentDatabase -Confirm:$false

创建内容数据库

New-SPContentDatabase -Name<ContentDBName> -WebApplication <WebApplicationName>
                                                           ------------------------------------切割线----------------------------------------
New-SPContentDatabase -Name WSS_Content_Intranet_Sales -WebApplication http://intranet.company.com

创建站点集

New-SPSite -URL “<URL for the new site collection>” -Name <name>  -ContentDatabase <content database name> -OwnerAlias “<domainuser>” -Template <template>
                                                           ------------------------------------切割线----------------------------------------
New-SPSite -URL “http://intranet.company.com/sites/sales” -Name “Sales” -ContentDatabase  WSS_Content_Intranet_Sales -OwnerAlias “COMPANYSPAdmin” -Template “STS#0″
        以上也不是什么新的知识,在其它地方你也可以看到。

我这里总结一下,仅仅是为了以后须要的时候,可以非常快地引用它们。

原文地址:https://www.cnblogs.com/liguangsunls/p/6826279.html