Examples/Resources/SPCreateFarm/2-CreateCustomCentralAdmin.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<#
.EXAMPLE
    This example shows how a basic SharePoint farm can be created. The database server and names
    are specified, and the accounts to run the setup as, the farm account and the passphrase are
    all passed in to the configuration to be applied. Here the port for the central admin site to
    run on, as well as the authentication mode for the site are also specified.
#>


    Configuration Example 
    {
        param(
            [Parameter(Mandatory = $true)]
            [PSCredential]
            $FarmAccount,

            [Parameter(Mandatory = $true)]
            [PSCredential]
            $SetupAccount,

            [Parameter(Mandatory = $true)]
            [PSCredential]
            $Passphrase
        )
        Import-DscResource -ModuleName SharePointDsc

        node localhost {
            SPCreateFarm CreateFarm
            {
                DatabaseServer            = "SQL.contoso.local\SQLINSTANCE"
                FarmConfigDatabaseName    = "SP_Config"
                AdminContentDatabaseName  = "SP_AdminContent"
                CentralAdministrationPort = 5000
                CentralAdministrationAuth = "Kerberos"
                Passphrase                = $Passphrase
                FarmAccount               = $FarmAccount
                PsDscRunAsCredential      = $SetupAccount
            }
        }
    }