DSC Module - Mandatory Parameters in helper functions need a better error message - by Tome Tanasovski

Status : 

 


9
0
Sign in
to vote
ID 799974 Comments
Status Active Workarounds
Type Suggestion Repros 1
Opened 9/8/2013 1:47:14 PM
Access Restriction Public

Description

If you are creating a custom DSC script provider and use a function with mandatory parameters outside of the core 3 functions: test-targetresource, set-targetresource, get-targetresource and you forget to supply those mandatory parameters, the error you receive is the following:

PowerShell Desired State Configuration does not support execution of commands in an interactive mode.
    + CategoryInfo          : OperationStopped: (:) [], CimException
    + FullyQualifiedErrorId : System.NotSupportedException
    + PSComputerName        : server2 

It would be really helpful if the error told you that you forgot to specify a mandatory parameter
Sign in to post a comment.
Posted by Lawrence Gripper on 8/14/2014 at 3:35 AM
Also hit this one and lost a fair amount of time trying to work out what was going on!
Posted by Aaron Jensen on 7/21/2014 at 10:55 AM
This can also happen if you've marked one of the parameters of your Get/Set/Test-TargetResource parameter as mandatory, but your configuration doesn't pass that value or passes it as `$null`. Only Key parameters should be marked as mandatory.