SharePoint的安装和配置-PowerShell

1. 引入SPModule组件

Import-Module SPModule.misc
Import-Module SPModule.setup

需要将执行策略修改为不限制

2. 无人值守安装SharePoint

Install-SharePoint –setupexepath D:\setup.exe –configxmlpath
c:\config.xml

配置文件示例

<Configuration>
    <Package Id="sts">
        <Setting Id="LAUNCHEDFROMSETUPSTS" Value="Yes"/>
    </Package>
    <Package Id="spswfe">
        <Setting Id="SETUPCALLED" Value="1"/>
    </Package>
    <Logging Type="verbose" Path="%temp%"
Template="SharePoint Server Setup(*).log"/>
    <!--<PIDKEY Value="Enter Product Key Here" />-->
    <Setting Id="SERVERROLE" Value="APPLICATION"/>
    <Setting Id="USINGUIINSTALLMODE" Value="1"/>
    <Setting Id="SETUPTYPE" Value="CLEAN_INSTALL"/>
    <Setting Id="SETUP_REBOOT" Value="Never"/>
</Configuration>

反注释PIDKEY,在Value属性处输入序列号

但是出于安全考虑,你可能不想把序列号存储在配置文件中,则可添加命令参数PIDKey

Install-SharePoint –setupexepath D:\setup.exe –configxmlpath
c:\config.xml -PIDKey "ABDCE-FGHIJ-KLMNO-PQRST-UVWXY"

3. 配置一个新的SharePoint场

New-SharePointFarm -databaseserver <server name>
-databaseaccessaccount (Get-Credential <domain\account>)
-farmname <name of new farm>
-passphrase (ConvertTo-SecureString -asplaintext -force -string "Enter a farm pass phrase here")

4. 添加一个服务器到SharePoint场

Join-SharePointFarm –databaseserver <database server name>
-configurationdatabasename <config database>
-passphrase (ConvertTo-SecureString -asplaintext -force -string
"<farm pass phrase>")

5. 创建一个Web应用程序

New-SPWebApplication –applicationpool <name of new application pool>
-name <name of new web app>
-applicationpoolaccount <service account to be used for the
application pool> -port <desired port number>

例如

New-SPWebApplication –applicationpool SharePoint-80
-name SharePoint-80 -applicationpoolaccount SP\AppPoolAccount -port 80

6. 创建一个网站集

New-SPSite –url <full url of new site collection>
-name <name of new site collection>
-owneralias <site collection administrator>
-template <site collection template to use>

例如

New-SPSite –url http://sp2010/ -name Home -owneralias SP\SiteAdmin
-template STS#0

网站模板名称可以通过Get-SPWebTemplates命令获得

7. 创建一个网站

New-SPWeb –url <full url of new site> -name <name of new site>
-template <site template to use> 
-AddToTopNav(Optional)
-UniquePermissions(Optional)
-UseParentTopNav(Optional)

例如

New-SPWeb –url http://sp2010/PSSubSite -name "PS Sub Site"
-template STS#0 –AddToTopNav –UniquePermissions -UseParentTopNav
上一篇:c语言中重要函数


下一篇:学生机房虚拟化(八)客户系统安装