Examples/cFileMirror.config.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
<#
 This is an example of the resource configuration file that generates both the MOF and the checksum file on the source server (DSC pull mode)
#>

Param
(
    [Parameter(Mandatory)]
    [String]$OutputPath
)

# Copy configuration file(s) from file shares
Configuration PrintHA_FileMirrorConfig
{
    Import-DscResource -ModuleName 'PrintHA.DSC'

    # Copy the PrintHA configuration file from the specified file share
    cFileMirror ConfigFile
    {
        Ensure='Present'
        SourceFolder = "\\share\PrintHA\AgentConfig"
        DestinationPath = "$env:ProgramFiles\PrintHA\PrintHA.config"            
    }
}

PrintHA_FileMirrorConfig -outputPath $OutputPath

New-DscChecksum -Path $OutputPath\localhost.mof -OutPath $OutputPath
del $OutputPath\PrintHA_FileMirrorConfig.*
ren -Path $OutputPath\localhost.mof -NewName PrintHA_FileMirrorConfig.mof -Force
ren -Path $OutputPath\localhost.mof.checksum -NewName PrintHA_FileMirrorConfig.mof.checksum -Force