PowerShell / PSDscResources

MIT License
129 stars 53 forks source link

File: Default checksum type not documented #196

Open rifftual opened 3 years ago

rifftual commented 3 years ago

Details of the scenario you tried and the problem that is occurring

By default, when using Directory type, the changes from source are not applied.

Verbose logs showing the problem

VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'. VERBOSE: An LCM method call arrived from computer FOO with user sid X-X-X-XX-XXX-XXX-XXX-XXX. VERBOSE: [FOO]: LCM: [ Start Set ] VERBOSE: [FOO]: LCM: [ Start Resource ] [[File]Foo1] VERBOSE: [FOO]: LCM: [ Start Test ] [[File]Foo1] VERBOSE: [FOO]: [[File]Foo1] Building file list without using cache. VERBOSE: [FOO]: [[File]Foo1] The destination object was found and no action is required. VERBOSE: [FOO]: LCM: [ End Test ] [[File]Foo1] in 0.0040 seconds. VERBOSE: [FOO]: LCM: [ Skip Set ] [[File]Foo1] VERBOSE: [FOO]: LCM: [ End Resource ] [[File]Foo1] VERBOSE: [FOO]: LCM: [ End Set ] VERBOSE: [FOO]: LCM: [ End Set ] in 0.0220 seconds. VERBOSE: Operation 'Invoke CimMethod' complete. VERBOSE: Time taken for configuration job to complete is 0.075 seconds

Suggested solution to the issue

Document which checksum type is used by default and why it is not picking up changes from the source path.

Specifying the checksum type (At least modifiedDate and SHA-512 worked) makes LCM to pick up changes from the source path.

The DSC configuration that is used to reproduce the issue (as detailed as possible)

Configuration Foo
{

    param ()

    Import-DscResource -ModuleName 'PSDscResources'

    Node "localhost"
    {
        File Foo1
        {
            Ensure = "Present" # Ensure the directory is Present on the target node.
            Type = "Directory" # The default is File.
            Recurse = $true # Recursively copy all subdirectories.            
            MatchSource = $true            
            SourcePath = "$(Get-Location)\Source"
            DestinationPath = "$(Get-Location)\Dest"            
        }
    }
}

The operating system the target node is running

OsName               : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 1809
WindowsBuildLabEx    : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version and build of PowerShell the target node is running

PSVersion                      5.1.17763.1490
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.1490
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version of the DSC module that was used ('dev' if using current dev branch)

dev