我正在编写一个DSC来配置本地配置管理器,它正在退出以下错误。此外,当我添加-force
标志时(由错误推荐),而不是帮助这种情况,PowerShell会话挂起,并且在我尝试从不同的运行相同的DSC文件之前不会恢复PS会话,也有强制选项,它将依次挂在它的位置。使用管理权限运行不会更改此设置。
这是我第二次使用Powershell DSC时出现问题,即使使用ctrl + break和ctrl + c也没有退出,这是一个常见的问题吗?
这是错误:
Cannot invoke the Set-DscLocalConfigurationManager cmdlet. The Set-DscLocalConfigurationManager cmdlet is in progress
and must return before Set-DscLocalConfigurationManager can be invoked. Use -Force option if that is available to
cancel the current operation.
+ CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1
+ PSComputerName : localhost
以下是我的DSC副本:
[DSCLocalConfigurationManager()]
Configuration LCMConfig
{
Node "localhost" # Since all vm's should be pulling or pushing or doing it at the same frequencey.
{
Settings {
ConfigurationMode = 'ApplyAndMonitor' # Maybe we'd want 'ApplyAndAutoCorrect' at some point.
RefreshFrequencyMins = 30 # Interval for checking the pull server
ConfigurationModeFrequencyMins = 30
RebootNodeIfNeeded = $true
ActionAfterReboot = "ContinueConfiguration" # This is the default but good to see explicitly.
RefreshMode = 'Push'
}
}
}
LCMConfig -OutputPath $PSScriptRoot
Set-DscLocalConfigurationManager -Path $PSScriptRoot -Verbose
Get-DscLocalConfigurationManager