DSCResources/XD7LabController/XD7LabController.schema.psm1

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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
configuration XD7LabController {
    param (
        ## Citrix XenDesktop installation source root
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [System.String] $XenDesktopMediaPath,

        ## Citrix XenDesktop site name
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [System.String] $SiteName,

        ## Existing XenDesktop controller used to join the site
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [System.String] $ExistingControllerAddress,

        ## List of all FQDNs and NetBIOS of XenDesktop site controller names for credential delegation
        [Parameter()]
        [ValidateNotNullOrEmpty()]
        [System.String[]] $DelegatedComputers,

        ## Active Directory domain account used to install/configure the Citrix XenDesktop site
        [Parameter()]
        [ValidateNotNull()]
        [System.Management.Automation.PSCredential]
        [System.Management.Automation.CredentialAttribute()]
        $Credential
    )

    Import-DscResource -ModuleName XenDesktop7;

    if ($PSBoundParameters.ContainsKey('DelegatedComputers')) {

        Import-DscResource -ModuleName xCredSSP;

        xCredSSP CredSSPServer {
            Role = 'Server';
        }

        xCredSSP CredSSPClient {
            Role = 'Client';
            DelegateComputers = $DelegatedComputers;
        }
    }

    XD7Feature 'XD7Controller' {
        Role = 'Controller';
        SourcePath = $XenDesktopMediaPath;
    }

    XD7Feature 'XD7Studio' {
        Role = 'Studio';
        SourcePath = $XenDesktopMediaPath;
    }

    if ($PSBoundParameters.ContainsKey('Credential')) {

        XD7WaitForSite 'WaitForXD7Site' {
            SiteName = $SiteName;
            ExistingControllerName = $ExistingControllerAddress;
            Credential = $Credential;
            DependsOn = '[XD7Feature]XD7Controller';
        }

        XD7Controller 'XD7ControllerJoin' {
            SiteName = $SiteName;
            ExistingControllerName = $ExistingControllerAddress;
            Credential = $Credential;
            DependsOn = '[XD7Feature]XD7Controller','[XD7WaitForSite]WaitForXD7Site';
        }
    }
    else {

        XD7WaitForSite 'WaitForXD7Site' {
            SiteName = $SiteName;
            ExistingControllerName = $ExistingControllerAddress;
            DependsOn = '[XD7Feature]XD7Controller';
        }

        XD7Controller 'XD7ControllerJoin' {
            SiteName = $SiteName;
            ExistingControllerName = $ExistingControllerAddress;
            DependsOn = '[XD7Feature]XD7Controller','[XD7WaitForSite]WaitForXD7Site';
        }
    }

} #end configuration XD7LabController