Examples/EndToEndExample/2-InstallAndRunJetstress.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
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
90
91
92
Configuration InstallAndRunJetstress
{   
    param
    (
        [PSCredential]$FileCopyCreds
    )

    Import-DscResource -Module xExchange

    Node $AllNodes.NodeName
    {
        #Create mount points for use with Jetstress. Here I prefer to use the same database names for ALL servers,
        #that way I can use the same JetstressConfig.xml for all of them.
        xExchAutoMountPoint AMPForJetstress
        {
            Identity                       = $Node.NodeName
            AutoDagDatabasesRootFolderPath = 'C:\ExchangeDatabases'
            AutoDagVolumesRootFolderPath   = 'C:\ExchangeVolumes'
            DiskToDBMap                    = $Node.JetstressDiskToDBMap
            SpareVolumeCount               = 0
            VolumePrefix                   = 'EXVOL'
            CreateSubfolders               = $true
        }

        #Copy the Jetstress install file
        File CopyJetstress
        {
            Ensure          = 'Present'
            SourcePath      = "$($Node.FileServerBase)\Jetstress\Jetstress.msi"
            DestinationPath = 'C:\Binaries\Jetstress\Jetstress.msi'
            Credential      = $FileCopyCreds
        }

        #Install Jetstress
        Package InstallJetstress
        {
            Ensure    = 'Present'
            Path      = 'C:\Binaries\Jetstress\Jetstress.msi'
            Name      = 'Microsoft Exchange Jetstress 2013'
            ProductId = '75189587-0D84-4404-8F02-79C39728FA64'

            DependsOn = '[xExchAutoMountPoint]AMPForJetstress','[File]CopyJetstress'
        }

        #Copy required ESE DLL's to the Jetstress installation directory
        File CopyESEDlls
        {
            Ensure          = 'Present'
            Type            = 'Directory'
            Recurse         = $true
            SourcePath      = "$($Node.FileServerBase)\Jetstress\ESEDlls"
            DestinationPath = 'C:\Program Files\Exchange Jetstress'
            Credential      = $FileCopyCreds

            DependsOn       = '[Package]InstallJetstress'
        }

        #Copy JetstressConfig.xml to the Jetstress installation directory
        File CopyJetstressConfig
        {
            Ensure          = 'Present'
            SourcePath      = "$($Node.FileServerBase)\Jetstress\JetstressConfig.xml"
            DestinationPath = 'C:\Program Files\Exchange Jetstress\JetstressConfig.xml'
            Credential      = $FileCopyCreds

            DependsOn       = '[Package]InstallJetstress'
        }

        #Run the Jetstress test, and evaluate the results
        xExchJetstress RunJetstress
        {
            Type            = 'Performance'
            JetstressPath   = 'C:\Program Files\Exchange Jetstress'
            JetstressParams = '/c "C:\Program Files\Exchange Jetstress\JetstressConfig.xml"'
            MinAchievedIOPS = 100

            DependsOn       = '[File]CopyESEDlls','[File]CopyJetstressConfig'
        }
    }
}

if ($FileCopyCreds -eq $null)
{
    $FileCopyCreds = Get-Credential -Message "Enter the credentials to copy Jetstress files from the file server"
}

###Compiles the example
InstallAndRunJetstress -ConfigurationData $PSScriptRoot\ExchangeSettings-Lab.psd1 -FileCopyCreds $FileCopyCreds

###Pushes configuration and waits for execution
#Start-DscConfiguration -Path .\InstallAndRunJetstress -Verbose -Wait -ComputerName XXX