Challenge - 5 Problems
DSC Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of this DSC configuration block?
Given the following DSC configuration, what will be the output when you run
Start-DscConfiguration -Path .\MyConfig -Wait -Verbose?PowerShell
Configuration MyConfig {
Node localhost {
File ExampleFile {
DestinationPath = "C:\\Temp\\example.txt"
Contents = "Hello DSC"
Ensure = "Present"
}
}
}
MyConfig
Start-DscConfiguration -Path .\MyConfig -Wait -VerboseAttempts:
2 left
💡 Hint
Think about what the File resource does in DSC and what the Ensure property means.
✗ Incorrect
The File resource in DSC creates or ensures the presence of a file at the specified DestinationPath with the given Contents. Running Start-DscConfiguration applies the configuration, so the file will be created with 'Hello DSC'.
📝 Syntax
intermediate2:00remaining
Identify the syntax error in this DSC configuration snippet
Which option correctly fixes the syntax error in this DSC configuration snippet?
PowerShell
Configuration SampleConfig {
Node localhost {
File SampleFile {
DestinationPath = "C:\\Temp\\sample.txt"
Contents "Sample content"
Ensure = "Present"
}
}
}Attempts:
2 left
💡 Hint
Look carefully at the property assignments inside the resource block.
✗ Incorrect
In DSC configuration syntax, properties must be assigned with an equals sign. The line 'Contents "Sample content"' is missing the equals sign, causing a syntax error.
🔧 Debug
advanced2:00remaining
Why does this DSC configuration fail to apply?
This DSC configuration is supposed to create a directory, but it fails. What is the reason?
PowerShell
Configuration CreateFolder {
Node localhost {
File NewFolder {
DestinationPath = "C:\\NewFolder"
Type = "Directory"
Ensure = "Present"
}
}
}
CreateFolder
Start-DscConfiguration -Path .\CreateFolder -Wait -VerboseAttempts:
2 left
💡 Hint
Check the documentation for the File resource properties.
✗ Incorrect
The File resource in DSC requires the DestinationPath to end with a trailing backslash when Type = 'Directory'. Without it, the configuration fails to apply.
🚀 Application
advanced2:00remaining
How to ensure a Windows feature is installed using DSC?
You want to use DSC to make sure the 'Web-Server' Windows feature is installed on a server. Which configuration snippet will achieve this?
Attempts:
2 left
💡 Hint
Check the correct property names and values for the WindowsFeature resource.
✗ Incorrect
The WindowsFeature resource uses 'Name' to specify the feature and 'Ensure' with values 'Present' or 'Absent' to install or remove the feature. 'FeatureName' and 'State' are invalid properties.
🧠 Conceptual
expert2:00remaining
What happens if you run Start-DscConfiguration twice with the same configuration?
You have applied a DSC configuration named 'MyConfig' on a node. You run
Start-DscConfiguration -Path .\MyConfig -Wait -Verbose again immediately. What will happen?Attempts:
2 left
💡 Hint
Think about the purpose of DSC's idempotency.
✗ Incorrect
DSC is designed to be idempotent. Running the same configuration again checks the current state and only makes changes if needed. If the node is already compliant, no changes occur.