Invalid Parameter when trying to enhance a DSC resource

Welcome Forums DSC (Desired State Configuration) Invalid Parameter when trying to enhance a DSC resource

  • This topic has 4 replies, 2 voices, and was last updated 2 months ago by
    Syl
    Blocked
    .
Viewing 3 reply threads
  • Author
    Posts
    • #274047
      Syl
      Blocked
      Topics: 14
      Replies: 35
      Points: 90
      Rank: Member

      I’ve been doing mostly terraform for the last 18 months and now I need to modify a DSC resource(so, I’m rusty) and I’m facing a strange problem.  To solve a problem I added a parameter to an existing DSC resource(part of the xWebsiteAdministration resource) but when I try to run it  it doesn’t recognize the extra paramater as valid(It’s called from ansible, but it’s the same when trying it with invoke-dscresource)

      “msg”: “Unsupported parameters for (ansible.windows.win_dsc) module: WebsiteName. Supported parameters include: Path, PsDscRunAsCredential_username, Filter, module_version, PsDscRunAsCredential_password, resource_name, OverrideMode, DependsOn”

      I added the paramter the usual way

      [Parameter(Mandatory = $true)]
      [ValidateNotNullOrEmpty()]
      [String]
      $WebsiteName`

      Any tips on what I am missing?  I looked at the rest of the code and didn’t see any other place to define a parameter.

      • This topic was modified 2 months ago by Syl.
    • #274242
      Senior Moderator
      Topics: 9
      Replies: 1449
      Points: 5,429
      Helping Hand
      Rank: Community MVP

      Did you add an extra parameter to an existing resource in xWebAdministration module and calling it from ansible ?

    • #274338
      Syl
      Blocked
      Topics: 14
      Replies: 35
      Points: 90
      Rank: Member

      Yes, that’s what I did

      • added a parameter to xIisFeatureDelegation
      • modified a line in the resource to use that parameter
      • deployed the modified module to the test server
      • called it using ansible(fail)
      • called it locally using invoke-dscresource to see if it was ansible or the resource itself(still a fail, with same message that the new parameter is not a valid one for the resource)

      EDIT: I made another reply with the code, but it seems to be stuck in moderation?.  Should appear eventually.

      • This reply was modified 2 months ago by Syl. Reason: added notification about other reply
    • #274350
      Syl
      Blocked
      Topics: 14
      Replies: 35
      Points: 90
      Rank: Member

      Here is the full command and result:

       

      Undefined property WebsiteName
      At line:11, char:2
      Buffer:
      irectResourceAccess”;
      };^
      insta
      + CategoryInfo : SyntaxError: (root/Microsoft/…gurationManager:String) [], CimException
      + FullyQualifiedErrorId : MiClientApiError_Failed
      + PSComputerName : localhost

      and here is the parameter definition in the Set-TargetResource

       

      • This reply was modified 2 months ago by Syl.
      • This reply was modified 2 months ago by Syl.
Viewing 3 reply threads
  • You must be logged in to reply to this topic.