Bird
0
0

How can you ensure that a DSC configuration only runs when a specific Windows feature is installed on the target node?

hard📝 Application Q9 of 15
PowerShell - Automation Patterns
How can you ensure that a DSC configuration only runs when a specific Windows feature is installed on the target node?
AUse the 'DependsOn' property to link the configuration to the WindowsFeature resource.
BManually check the feature before running the configuration script.
CInclude a conditional statement inside the Configuration block to skip nodes without the feature.
DSet the 'Ensure' property of the configuration to 'Present' for the feature.
Step-by-Step Solution
Solution:
  1. Step 1: Understand resource dependencies in DSC

    DSC supports 'DependsOn' to ensure one resource runs after another, enforcing order.
  2. Step 2: Apply to WindowsFeature and dependent resources

    Using DependsOn links the configuration to the WindowsFeature resource, so it runs only after the feature is present.
  3. Final Answer:

    Use the 'DependsOn' property to link the configuration to the WindowsFeature resource. -> Option A
  4. Quick Check:

    DependsOn enforces resource order in DSC [OK]
Quick Trick: Use DependsOn to order DSC resources [OK]
Common Mistakes:
  • Trying manual checks instead of DSC dependencies
  • Misusing Ensure property for dependencies
  • Using conditional statements inside Configuration block

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes