我的DSC节点没有从我的SMB DSC服务器中提取DSC配置。说拉是成功的,但是DSCConfigurationStatus保持不变(旧配置)。
我在C驱动器上创建一个文件的HelloWorld配置来测试它。我没有任何错误或其他任何事。为什么它拉得不对。
我的DSC LCM配置:
$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
}
)
}我的HelloWord配置:
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!"
}
}
}更新-DScConfiguration说,没有新的配置,所以它不会拉。我是否理解DSC正确的,它有一个配置和节点尝试适合这个配置。因此,它必须再次拉一个配置,并应用它,相反,它保留旧的配置,拒绝拉。但是旧的配置是错误的..。我不明白..。
发布于 2019-07-16 13:13:56
这是ConfigurationMode,它必须在DSCLocalConfigurationManager中的设置下设置为ApplyAndAutocorrect!
https://serverfault.com/questions/970337
复制相似问题