Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DnsServerSetting: failed to execute Set-TargetResource functionality with error message: Generic failure #87

Open
cmazza87 opened this issue Apr 24, 2019 · 7 comments
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@cmazza87
Copy link

cmazza87 commented Apr 24, 2019

Details of the scenario you tried and the problem that is occurring

I am trying to set the ListenAddresses property. If no change is required, it runs successfully. However, if ListenAddress needs to be changed, it errors out. I've changed the IP addresses from their actual addresses.

Verbose logs showing the problem

Successful run:
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer DC1 with user sid
VERBOSE: [DC1]: LCM: [ Start Set ]
VERBOSE: [DC1]: LCM: [ Start Resource ] [[xDnsServerSetting]DnsServerProperties]
VERBOSE: [DC1]: LCM: [ Start Test ] [[xDnsServerSetting]DnsServerProperties]
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Evaluating the DNS server settings.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Getting DNS Server Settings.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\MicrosoftDNS,'className' = MicrosoftDNS_Server'.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Operation 'Enumerate CimInstances' complete.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = Get,'className' = PS_DnsServerDiagnostics,'namespaceName' = root/Mi
crosoft/Windows/DNS'.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Operation 'Invoke CimMethod' complete.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] MATCH: Value (type Boolean) for property 'NoRecursion' does match. Current state is 'False' and desired state is 'False'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Comparing values in property 'ListenAddresses'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] MATCH: Value [0] (type String) for property 'ListenAddresses' does match. Current state is '1.1.1.1' and desired state is '1.1.1.1'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] MATCH: Value (type String) for property 'LogFilePath' does match. Current state is 'C:\dns\dns.log' and desired state is 'C:\dns\dns.log'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] MATCH: Value (type UInt32) for property 'LogLevel' does match. Current state is '24865' and desired state is '24865'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] MATCH: Value (type String) for property 'Name' does match. Current state is 'DnsServerSetting' and desired state is 'DnsServerSetting'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] MATCH: Value (type UInt32) for property 'AllowUpdate' does match. Current state is '1' and desired state is '1'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Comparing values in property 'Forwarders'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] MATCH: Value [0] (type String) for property 'Forwarders' does match. Current state is '2.2.2.2' and desired state is '2.2.2.2'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] MATCH: Value [1] (type String) for property 'Forwarders' does match. Current state is '3.3.3.3' and desired state is '3.3.3.3'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Result is 'True'
VERBOSE: [DC1]: LCM: [ End Test ] [[xDnsServerSetting]DnsServerProperties] in 0.7270 seconds.
VERBOSE: [DC1]: LCM: [ Skip Set ] [[xDnsServerSetting]DnsServerProperties]
VERBOSE: [DC1]: LCM: [ End Resource ] [[xDnsServerSetting]DnsServerProperties]
VERBOSE: [DC1]: LCM: [ End Set ]
VERBOSE: [DC1]: LCM: [ End Set ] in 1.0020 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 1.064 seconds

Failure:

VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer DC1 with user sid
VERBOSE: [DC1]: LCM: [ Start Set ]
VERBOSE: [DC1]: LCM: [ Start Resource ] [[xDnsServerSetting]DnsServerProperties]
VERBOSE: [DC1]: LCM: [ Start Test ] [[xDnsServerSetting]DnsServerProperties]
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Evaluating the DNS server settings.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Getting DNS Server Settings.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\MicrosoftDNS,'className' = MicrosoftDNS_Server'.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Operation 'Enumerate CimInstances' complete.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = Get,'className' = PS_DnsServerDiagnostics,'namespaceName' = root/Mi
crosoft/Windows/DNS'.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Operation 'Invoke CimMethod' complete.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] MATCH: Value (type Boolean) for property 'NoRecursion' does match. Current state is 'False' and desired state is 'False'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Comparing values in property 'ListenAddresses'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] NOTMATCH: Value (type String[]) for property 'ListenAddresses' does have a different count. Current state count is '2' and desired state count is '
1'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] MATCH: Value (type String) for property 'LogFilePath' does match. Current state is 'C:\dns\dns.log' and desired state is 'C:\dns\dns.log'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] MATCH: Value (type UInt32) for property 'LogLevel' does match. Current state is '24865' and desired state is '24865'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] MATCH: Value (type String) for property 'Name' does match. Current state is 'DnsServerSetting' and desired state is 'DnsServerSetting'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] MATCH: Value (type UInt32) for property 'AllowUpdate' does match. Current state is '1' and desired state is '1'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Comparing values in property 'Forwarders'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] MATCH: Value [0] (type String) for property 'Forwarders' does match. Current state is '2.2.2.2' and desired state is '2.2.2.2'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] MATCH: Value [1] (type String) for property 'Forwarders' does match. Current state is '3.3.3.3' and desired state is '3.3.3.3'
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Result is 'False'
VERBOSE: [DC1]: LCM: [ End Test ] [[xDnsServerSetting]DnsServerProperties] in 0.7450 seconds.
VERBOSE: [DC1]: LCM: [ Start Set ] [[xDnsServerSetting]DnsServerProperties]
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\MicrosoftDNS,'className' = MicrosoftDNS_Server'.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Operation 'Enumerate CimInstances' complete.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Setting Dns setting 'LogLevel' to value '24865'.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Setting Dns setting 'NoRecursion' to value 'False'.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Setting Dns setting 'LogFilePath' to value 'C:\dns\dns.log'.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Setting Dns setting 'Forwarders' to value 'System.String[]'.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Setting Dns setting 'AllowUpdate' to value '1'.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Setting Dns setting 'ListenAddresses' to value 'System.String[]'.
VERBOSE: [DC1]: [[xDnsServerSetting]DnsServerProperties] Perform operation 'Modify CimInstance' with following parameters, ''namespaceName' = root/MicrosoftDNS,'instance' = MicrosoftDNS_Server (Name = "dc
1")'.
VERBOSE: [DC1]: LCM: [ End Set ] [[xDnsServerSetting]DnsServerProperties] in 0.4790 seconds.
PowerShell DSC resource MSFT_xDnsServerSetting failed to execute Set-TargetResource functionality with error message: Generic failure
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName : localhost

VERBOSE: [DC1]: LCM: [ End Set ]
The SendConfigurationApply function did not succeed.
+ CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1
+ PSComputerName : localhost

VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 1.538 seconds

Suggested solution to the issue

The DSC configuration that is used to reproduce the issue (as detailed as possible)

# insert configuration here
configuration Sample_DnsSettings
{
    Import-DscResource -ModuleName xDnsServer

    node localhost
    {
        xDnsServerSetting DnsServerProperties
        {
            Name = 'DnsServerSetting'
            ListenAddresses = '1.1.1.1'
            Forwarders = '2.2.2.2','3.3.3.3'
            NoRecursion = $false
            LogLevel = 24865
            AllowUpdate = 1
            LogFilePath = 'C:\dns\dns.log'
        }
    }
}

Sample_DnsSettings

Start-DscConfiguration -Wait -Force -Path .\Sample_DnsSettings -Verbose

#### The operating system the target node is running
<!--
    Please provide as much as possible about the target node, for example
    edition, version, build and language.
    On OS with WMF 5.1 the following command can help get this information.

    Get-ComputerInfo -Property @(
        'OsName',
        'OsOperatingSystemSKU',
        'OSArchitecture',
        'WindowsVersion',
        'WindowsBuildLabEx',
        'OsLanguage',
        'OsMuiLanguages')
-->
OsName               : Microsoft Windows Server 2012 R2 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture       : 64-bit
WindowsBuildLabEx    : 9600.19321.amd64fre.winblue_ltsb_escrow.190313-1806
OsLanguage           : en-US
OsMuiLanguages       : {en-US}


#### Version and build of PowerShell the target node is running
<!--
    To help with this information, please run this command:
    $PSVersionTable
-->
PSVersion                      5.1.14409.1018                                                                                                                                                                                         
PSEdition                      Desktop                                                                                                                                                                                                
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                                
BuildVersion                   10.0.14409.1018                                                                                                                                                                                        
CLRVersion                     4.0.30319.42000                                                                                                                                                                                        
WSManStackVersion              3.0                                                                                                                                                                                                    
PSRemotingProtocolVersion      2.3                                                                                                                                                                                                    
SerializationVersion           1.1.0.1   



#### Version of the DSC module that was used ('dev' if using current dev branch)

v1.11.0.0
@johlju johlju added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Mar 3, 2020
@tred23
Copy link

tred23 commented Apr 23, 2020

I have the same issue with setting DNS Server IP in Windows Server 2019. All other setting take no issue, IP, Subnet, Default Gateway. Only DNS errors every time.

PowerShell DSC resource MSFT_DnsServerAddress failed to execute Set-TargetResource
functionality with error message: The running command stopped because the preference
variable "ErrorActionPreference" or common parameter is set to Stop: A general error
occurred that is not covered by a more specific error code.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName : localhost

@johlju
Copy link
Member

johlju commented Feb 10, 2021

This is error is generated by the ListenAddresses property.

@johlju
Copy link
Member

johlju commented Feb 10, 2021

The following error is generated when none of the specified IP addresses exist on a network interface. The resource should check available IP addresses on the node and throw an exception saying that neither IP address is available on a network interface.

PowerShell DSC resource MSFT_xDnsServerSetting  failed to execute Set-TargetResource functionality with error message: Gener
ic failure  
    + CategoryInfo          : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : localhost

@johlju johlju changed the title xDnsServerSetting: failed to execute Set-TargetResource functionality with error message: Generic failure xDnsServerSetting: failed to execute Set-TargetResource functionality with error message: Generic failure Mar 20, 2021
@johlju johlju changed the title xDnsServerSetting: failed to execute Set-TargetResource functionality with error message: Generic failure DnsServerSetting: failed to execute Set-TargetResource functionality with error message: Generic failure Mar 31, 2021
@benohara
Copy link

I see this when setting ListenAddress to a valid IP thats on the interface, but the DNS server is currently configured to 'All Addresses'

If I manually change the setting to the ip im trying to set it to, the DSC then updates correctly.

I cant see anyway to pass 'All IP Addreses' to the DSC listenaddresses option?

@johlju
Copy link
Member

johlju commented May 13, 2021

I see this when setting ListenAddress to a valid IP thats on the interface, but the DNS server is currently configured to 'All Addresses'

I can't reproduce this this. But in my lab it moves from AllIPAddresses setting to just using one (of two) IP addresses. But I did see that if having the GUI up, it needed a refresh to reflect the change.

I cant see anyway to pass 'All IP Addreses' to the DSC listenaddresses option?

It seems the read-only property here holds all the addresses (Get-DnsServerSetting -all).AllIPAddress but the resource does not currently support Get-DnsServerSetting (being tracked in issue #185).

@benohara
Copy link

Cheers, actually seeing some other strange things on a windows 2019 machine.

dnsserver throws an error about not being able to write to the log when puppet runs, however, the log it references is 'c:\windows%systemroot%\system32\DNS\dns.log' hardcoding this to 'c:\windows\system32\dns\dns.log stops the error (not sure whats going on here)

This machine has 2 forwarders configured, when passing in a comma seperated list of 6 it says it changed, but doesnt actually apply. Subsequent runs also show it doing corrective changes that again dont apply. This did work ok (at least showed no change) when run on a test machine with only 1 forwarder.

If I pull the powershell code out of a debug log I see this when running the invoke-dscresource with a -debug flag...

VERBOSE: [GNWSPRMGTADC02]: [[xDnsServerSetting]DirectResourceAccess] NOTMATCH: Value (type
String[]) for property 'Forwarders' does have a different count. Current state count is '2' and desired state count is
'1'

Shouldnt the desired count be 6?

I also see some dsc changes mentioning that forwarders and logfilepath are moved to their own dsc options (not sure what version actually get used here)
https://github.com/dsccommunity/DnsServerDsc/releases

We're using puppetlabs-dsc 1.9.4

Just getting started with dsc so possibly missing something obvious.

@johlju
Copy link
Member

johlju commented May 13, 2021

Please open separate issues for other issues you are seeing so we don’t add things to this issue that are not related to ListeningIPAddresa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

4 participants