我正在使用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
}
}}
运行上述配置后,目录目标将反映目录源,但.pdb文件除外。单个文件的行为与PdbFile块中的行为相同
我已经运行了一些重命名文件的测试,但这没有任何影响。这似乎与.PDB格式有关。
有没有人看到过这种行为,知道是什么原因造成的,或者知道上面的配置是否不正确?
发布于 2017-05-27 06:00:59
我就是碰巧遇到了这样的问题。对我来说,最完美的解决方法是:Archive
这很好,至少对我来说是这样。
示例:
Archive ArchiveSourcezip
{
Ensure = 'Present'
Path = '\\Source\Directory\source.zip'
Destination = 'C:\ExtractionPath'
}
Log LogExample
{
Message = 'Archive source.zip was transferred.'
}编辑:另一个选项:使用modifiedDate als校验和测试!这似乎是最可靠的。
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'
}您可能还想使用Log-Resource:
Log LogFileScriptsPowerShellPath {
Message = 'Created and filled ScriptsPowerShellPath'
DependsOn = '[File]ScriptsPowerShellPath'
}这可能会很有用。
https://stackoverflow.com/questions/33638866
复制相似问题