Customer resource, Test-TargetResource failing

This topic contains 4 replies, has 3 voices, and was last updated by  Jason Boyd 2 years, 11 months ago.

  • Author
  • #18796

    Jason Boyd

    I have created a new DSC resource and it seems to fail no matter what I do. It is indicating that I am not returning a boolean from the Test-TargetResource function but I definitely am (you can see that I am below where I am outputting the the result and the result type). This is the second resource that I have created; I had no issues with the first. I cannot figure out what is going on here.

    VERBOSE: [WIN-V3SJ92A5IFR]: LCM: [ Start Resource ] [[ASI_cWebDynamicIpSecurity]BonoboGitDynamicIpSecurity]
    VERBOSE: [WIN-V3SJ92A5IFR]: LCM: [ Start Test ] [[ASI_cWebDynamicIpSecurity]BonoboGitDynamicIpSecurity]
    VERBOSE: [WIN-V3SJ92A5IFR]: [[ASI_cWebDynamicIpSecurity]BonoboGitDynamicIpSecurity] Entering Test-TargetResource.
    VERBOSE: [WIN-V3SJ92A5IFR]: [[ASI_cWebDynamicIpSecurity]BonoboGitDynamicIpSecurity] Entering Get-TargetResource.
    VERBOSE: [WIN-V3SJ92A5IFR]: [[ASI_cWebDynamicIpSecurity]BonoboGitDynamicIpSecurity] Leaving Get-TargetResource.
    VERBOSE: [WIN-V3SJ92A5IFR]: [[ASI_cWebDynamicIpSecurity]BonoboGitDynamicIpSecurity] The RequestIntervalInMilliseconds state for website IIS:\Sites\BonoboGi
    tServer does not match the desired state.
    VERBOSE: [WIN-V3SJ92A5IFR]: [[ASI_cWebDynamicIpSecurity]BonoboGitDynamicIpSecurity] Test result: False
    VERBOSE: [WIN-V3SJ92A5IFR]: [[ASI_cWebDynamicIpSecurity]BonoboGitDynamicIpSecurity] Result type: bool
    VERBOSE: [WIN-V3SJ92A5IFR]: [[ASI_cWebDynamicIpSecurity]BonoboGitDynamicIpSecurity] Leaving Test-TargetResource.
    VERBOSE: [WIN-V3SJ92A5IFR]: LCM: [ End Test ] [[ASI_cWebDynamicIpSecurity]BonoboGitDynamicIpSecurity] in 0.0150 seconds.
    The PowerShell provider C:\Program Files\WindowsPowerShell\Modules\ASI_cWebAdministration\DscResources\ASI_cWebDynamicIpSecurity returned results in a format that is not valid. The
    results from running Test-TargetResource must be the boolean value True or False.
    + CategoryInfo : InvalidResult: (:) [], CimException
    + FullyQualifiedErrorId : TestTargetResourceInvalidResultFormat
    + PSComputerName : localhost

    VERBOSE: [WIN-V3SJ92A5IFR]: LCM: [ End Set ]
    The SendConfigurationApply function did not succeed.
    + CategoryInfo : NotImplemented: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 7
    + PSComputerName : localhost

  • #18798

    Stephen Owen

    Can you show us your resource? I'm seeing result type bool vs. boolean (you know, the difference between 'True' or '$True'), and I'm wondering if the answer may be found within your resource.

  • #18799

    Jason Boyd

    Sure, I uploaded what I have to GitHub: Thanks for taking a look at this.

  • #18817

    Aaron Jensen

    This line is returning an object before you return a bool:

  • #19099

    Jason Boyd

    Thank you so much! That solved my problem.

You must be logged in to reply to this topic.