我的DSC节点未从我的SMB DSC服务器提取DSC配置。 Get-DSCConfigurationStatus表示拉取成功,但是Get-DSCConfiguration
保持相同(旧)配置。
我正在用HelloWorld配置对其进行测试,该配置在C驱动器上创建了一个文件。当我删除文件Get-DSCConfiguration
时说“ Enusre:不存在”,但是当它拉出新配置时,应该“确保:存在”。我没有错误或其他任何东西。知道为什么它不能正确拉动。
我的DSC LCM和Hello World配置:
$secpasswd = ConvertTo-SecureString “PASSWORD” -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential (“SERVUSER”, $secpasswd)
[DSCLocalConfigurationManager()]
configuration PullClientConfig
{
param(
[PSCredential]$DomainCredential
)
Node 'localhost'
{
Settings
{
RefreshMode = 'Pull'
RefreshFrequencyMins = 30
RebootNodeIfNeeded = $false
ConfigurationID = '2fda9b6d-e1be-46a9-8b92-e25cb17026cd'
}
ConfigurationRepositoryShare SmbConfigShare
{
SourcePath = '\\SERVER\SHARE'
Credential = $mycreds
}
ResourceRepositoryShare SmbResourceShare
{
SourcePath = '\\SERVER\SHARE'
Credential = $mycreds
}
}
}
$cd = @{
AllNodes = @(
@{
NodeName = 'localhost'
PSDscAllowPlainTextPassword = $true
}
)
}
My HelloWord config:
Configuration HelloWorld {
param (
[string[]]$ComputerName = "localhost" # i have changed this parameter to the servername
)
# Import the module that contains the File resource.
Import-DscResource -ModuleName PsDesiredStateConfiguration
# The Node statement specifies which targets to compile MOF files for, when this configuration is executed.
Node $ComputerName {
# The File resource can ensure the state of files, or copy them from a source to a destination with persistent updates.
File HelloWorld {
DestinationPath = "C:\HelloWorld.txt"
Ensure = "Present"
Contents = "Hello World from DSC!"
}
}
}
Update-DScConfiguration
说,没有较新的配置,因此它不会退出。我是否了解DSC Right,它具有一个配置,并且该节点尝试适合该配置。因此,它基本上必须再次拉出配置并应用它,而是保留旧的配置,拒绝拉取。但是旧的配置是错误的。...我不明白...