Examples/TextFile.Example.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$output = 'C:\DSCMOF'

Configuration TextTest
{
    Import-DscResource -ModuleName DSCR_FileContent
    Node localhost
    {
        TextFile TextTest {
            Ensure   = 'Present'
            Path     = "C:\sample.txt"
            Contents = 'sample text'
            Encoding = 'utf8NoBOM'   #utf8 without bom
            NewLine  = 'CRLF'
        }
    }
}

TextTest -OutputPath $output
Start-DscConfiguration -Path  $output -Verbose -wait
Remove-DscConfigurationDocument -Stage Current, Previous, Pending -Force