PowerShell - Automation PatternsHow 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.Check Answer
Step-by-Step SolutionSolution:Step 1: Understand resource dependencies in DSCDSC supports 'DependsOn' to ensure one resource runs after another, enforcing order.Step 2: Apply to WindowsFeature and dependent resourcesUsing DependsOn links the configuration to the WindowsFeature resource, so it runs only after the feature is present.Final Answer:Use the 'DependsOn' property to link the configuration to the WindowsFeature resource. -> Option AQuick 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 dependenciesMisusing Ensure property for dependenciesUsing conditional statements inside Configuration block
Master "Automation Patterns" in PowerShell9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PowerShell Quizzes Active Directory - AD module installation - Quiz 11easy Automation Patterns - Monitoring scripts with email alerts - Quiz 8hard Automation Patterns - Configuration drift detection - Quiz 1easy Cross-Platform PowerShell - PowerShell on macOS - Quiz 14medium Remote Management - PowerShell Remoting (Enable-PSRemoting) - Quiz 10hard Remote Management - Enter-PSSession - Quiz 9hard Scripting Best Practices - Verbose and debug output - Quiz 13medium Scripting Best Practices - Parameter validation - Quiz 10hard Scripting Best Practices - Parameter validation - Quiz 15hard System Administration - Scheduled task management - Quiz 2easy