Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to read the value of a registry key.
PowerShell
Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer' | Select-Object -Property [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using cmdlets like Get-Item instead of property names.
Trying to use Remove-Item which deletes keys instead of reading.
✗ Incorrect
The 'Shell Folders' property is used to read specific registry values under the given path.
2fill in blank
mediumComplete the code to create a new registry key.
PowerShell
New-Item -Path 'HKCU:\Software\MyApp' -Name [1] -Force
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using cmdlets like Get-Item or Remove-Item as the name.
Omitting the name parameter or giving an invalid value.
✗ Incorrect
The '-Name' parameter specifies the name of the new subkey to create under the given path.
3fill in blank
hardFix the error in the code to set a registry value.
PowerShell
Set-ItemProperty -Path 'HKCU:\Software\MyApp\Settings' -Name [1] -Value 'Enabled'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using cmdlets like Get-Item or New-Item instead of a value name.
Confusing the key name with the value name.
✗ Incorrect
The '-Name' parameter should be the name of the registry value to set, such as 'Status'.
4fill in blank
hardFill both blanks to delete a registry value safely.
PowerShell
Remove-ItemProperty -Path 'HKCU:\Software\MyApp\Settings' -Name [1] -ErrorAction [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect value names or error actions that stop the script.
Omitting error handling causing script to fail if value missing.
✗ Incorrect
The '-Name' parameter specifies the value to delete, and '-ErrorAction SilentlyContinue' avoids errors if the value does not exist.
5fill in blank
hardFill all three blanks to list all subkeys under a registry path.
PowerShell
$keys = Get-ChildItem -Path [1] | ForEach-Object { $_.[2] } ; $keys | Where-Object { $_ -like [3] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Value' instead of 'Name' to get subkey names.
Incorrect path or filter pattern causing no results.
✗ Incorrect
Get-ChildItem lists subkeys under the path 'HKCU:\Software\MyApp'. The 'Name' property gets each subkey's name. The filter '*Settings*' selects keys containing 'Settings'.