Examples/RESONEAutomationLabExample.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
41
42
43
44
45
46
47
48
49
50
51
52
$config = @{
    AllNodes = @(
        @{
            NodeName = 'localhost';
            PSDSCAllowPlainTextPassword = $true;

            ROADatabaseServer = 'controller.lab.local';
            ROADatabaseName   = 'RESONEAutomation';
            ROABinaryPath     = 'C:\SharedData\Software\RES\ONE Automation 2015\SR1';
            ROABinaryVersion  = '7.5.1.0';
        }
    )
}

configuration RESONEAutomationLabExample {
    param (
        ## RES ONE Automation SQL database/user credential
        [Parameter(Mandatory)]
        [System.Management.Automation.PSCredential]
        [System.Management.Automation.Credential()]
        $Credential,

        ## Microsoft SQL Server credentials used to create the RES ONE Automation database/user
        [Parameter(Mandatory)]
        [System.Management.Automation.PSCredential]
        [System.Management.Automation.Credential()]
        $SQLCredential
    )

    Import-DscResource -ModuleName RESONEAutomation;

    node 'localhost' {

        ROALab 'ROALab' {

            DatabaseServer = $node.ROADatabaseServer;
            DatabaseName   = $Node.ROADatabaseName;
            Path           = $node.ROABinaryPath;
            Version        = $node.ROABinaryVersion;
            SQLCredential  = $SQLCredential;
            Credential     = $Credential;
            Ensure         = 'Present';
        }

    }

} #end configuration RESONEAutomationLabExample

if (-not $cred) { $cred = Get-Credential -UserName 'RESONEAutomation' -Message 'RES ONE Automation SQL account credential'; }
if (-not $sqlCred) { $sqlCred = Get-Credential -UserName 'sa' -Message 'Existing SQL account for database creation'; }
RESONEAutomationLabExample -OutputPath ~\Documents -ConfigurationData $config -Credential $cred -SQLCredential $sqlCred;