DSC文件资源文件不复制PDB文件

Ber*_*doy 6 powershell dsc

我正在使用DSC文件资源更新具有最新版本的应用程序服务器.除了.PDB文件之外,这很有用.这些从未得到更新.我只用一个文件重现了这种行为.这是一个示例配置

Configuration FileTestConfiguration {
    param($HostName)

    Node $HostName {
        File AppDirectory {
        SourcePath = "c:\temp\dsc\source"
        DestinationPath = "c:\temp\dsc\target"
        Type = 'Directory'
        Checksum ='SHA-256'
        Recurse = $true
        MatchSource = $true
    }
    File PdbFile {
        SourcePath = "c:\temp\dsc\pdbSource\MyNetHelpers.pdb"
        DestinationPath = "c:\temp\dsc\pdbTarget\MyNetHelpers.pdb"
        Checksum ='SHA-256'
        Recurse = $true
        MatchSource = $true
    }
}
Run Code Online (Sandbox Code Playgroud)

}

运行上面的配置后,目录目标将反映目录源,但.pdb文件除外.与PdbFile块中的单个文件一样,表现出相同的行为

我已经运行了一些重命名文件的测试,但这没有任何影响.它似乎与.PDB格式有关.

有没有人看到过这种行为,知道是什么导致它或知道上面的配置是否不正确?

Joe*_*ald 0

我刚刚偶然发现了这样一个问题。对我来说完美的解决方法:存档

效果很好,至少对我来说

样本:

Archive ArchiveSourcezip
{
    Ensure = 'Present'
    Path = '\\Source\Directory\source.zip'
    Destination = 'C:\ExtractionPath'
}

Log LogExample
{
    Message = 'Archive source.zip was transferred.'
}
Run Code Online (Sandbox Code Playgroud)

编辑: 另一种选择:使用modifiedDate als Checksum Test!这似乎是最可靠的。

File ScriptsPowerShellPath {
    Ensure = 'Present'
    Type = 'Directory'
    Recurse = $true
    SourcePath = '\\Server\share'
    DestinationPath = $env:SystemDrive+'\directrory\target'
    Force = $true
    Checksum = 'modifiedDate'
    MatchSource = $true
    DependsOn = '[File]ScriptsPath'
}
Run Code Online (Sandbox Code Playgroud)

您可能还想使用日志资源:

Log LogFileScriptsPowerShellPath {
    Message = 'Created and filled ScriptsPowerShellPath'
    DependsOn = '[File]ScriptsPowerShellPath'
}
Run Code Online (Sandbox Code Playgroud)

这可能有用。