Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a DSC configuration named 'MyConfig'.
PowerShell
Configuration MyConfig {
Node localhost {
File ExampleFile {
DestinationPath = 'C:\Temp\example.txt'
Contents = 'Hello DSC!'
Ensure = '[1]'
}
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Installed' which is not valid for File resource.
Using 'Running' or 'Enabled' which apply to services, not files.
✗ Incorrect
The 'Ensure' property in DSC File resource uses 'Present' to make sure the file exists.
2fill in blank
mediumComplete the code to apply the DSC configuration stored in 'MyConfig'.
PowerShell
Start-DscConfiguration -Path '[1]' -Wait -Verbose
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a path that does not contain the MOF files.
Confusing script folder with configuration folder.
✗ Incorrect
The DSC configuration is usually compiled to a MOF file in a folder like 'C:\DSC\MyConfig'.
3fill in blank
hardFix the error in the DSC configuration to ensure the service 'Spooler' is running.
PowerShell
Configuration ServiceConfig {
Node localhost {
Service PrintSpooler {
Name = 'Spooler'
State = '[1]'
}
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Present' which is invalid for service state.
Using 'Enabled' which controls startup type, not running state.
✗ Incorrect
The 'State' property for the Service resource should be set to 'Running' to ensure the service is running.
4fill in blank
hardFill both blanks to create a DSC configuration that ensures the 'C:\Logs' folder exists and the 'W32Time' service is running.
PowerShell
Configuration MultiResourceConfig {
Node localhost {
File LogsFolder {
DestinationPath = 'C:\Logs'
Ensure = '[1]'
Type = 'Directory'
}
Service TimeService {
Name = 'W32Time'
State = '[2]'
}
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Absent' for folder when it should exist.
Using 'Stopped' for service when it should be running.
✗ Incorrect
To ensure the folder exists, 'Ensure' should be 'Present'. To keep the service running, 'State' should be 'Running'.
5fill in blank
hardFill all three blanks to create a DSC configuration that ensures a file exists, a service is running, and the configuration is applied.
PowerShell
Configuration FullConfig {
Node localhost {
File ConfigFile {
DestinationPath = 'C:\Config\settings.ini'
Contents = 'mode=auto'
Ensure = '[1]'
}
Service ConfigService {
Name = 'ConfigSvc'
State = '[2]'
}
}
}
FullConfig
Start-DscConfiguration -Path '[3]' -Wait -Verbose Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Stopped' for service state.
Using wrong path for Start-DscConfiguration.
✗ Incorrect
The file should be ensured as 'Present', the service state 'Running', and the configuration path is the folder '.\FullConfig' created by the configuration.