Examples/Sample_xFileUpload.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
Configuration FileUploadConfiguration
{
param (
    [parameter(Mandatory = $true)]
    [String] $destinationPath,
    [parameter(Mandatory = $true)]
    [String] $sourcePath,
    [PSCredential] $credential,
    [String] $certificateThumbprint
)

Import-DscResource -modulename xPSDesiredStateConfiguration
node localhost 
{
    xFileUpload fileUpload 
    {
        destinationPath = $destinationPath
        sourcePath = $sourcePath
        credential = $credential
        certificateThumbprint = $certificateThumbprint
    }
}

}

#Sample use (please change values of parameters according to your scenario):

#$credential = New-Object System.Management.Automation.PSCredential -ArgumentList "domain\user", (ConvertTo-SecureString -String "password" -AsPlainText -Force)
#$certificateThumbprint = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
#FileUploadConfiguration -destinationPath "\\machinename\folder" -sourcePath "C:\folder\file.txt" -credential $credential -certificateThumbprint $certificateThumbprint
#Start-DscConfiguration -Path .\FileUploadConfiguration -wait -verbose -debug