Bird
0
0

Which of the following is the correct syntax to set a registry value named TestValue to 123 under HKCU:\Software\MyApp?

easy📝 Syntax Q12 of 15
PowerShell - System Administration
Which of the following is the correct syntax to set a registry value named TestValue to 123 under HKCU:\Software\MyApp?
AGet-ItemProperty -Path 'HKCU:\Software\MyApp' -Name 'TestValue' -Value 123
BSet-ItemProperty -Path 'HKCU:\Software\MyApp' -Value 'TestValue' -Name 123
CSet-ItemProperty -Path 'HKCU:\Software\MyApp' -Name 'TestValue' -Value 123
DNew-Item -Path 'HKCU:\Software\MyApp' -Name 'TestValue' -Value 123
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct cmdlet and parameters

    Set-ItemProperty sets a registry value. The parameters are -Path for key, -Name for value name, and -Value for the data.
  2. Step 2: Check parameter order and names

    Set-ItemProperty -Path 'HKCU:\Software\MyApp' -Name 'TestValue' -Value 123 correctly uses -Path, -Name, and -Value in proper order. Other options mix parameters or use wrong cmdlets.
  3. Final Answer:

    Set-ItemProperty -Path 'HKCU:\Software\MyApp' -Name 'TestValue' -Value 123 -> Option C
  4. Quick Check:

    Set-ItemProperty syntax = Set-ItemProperty -Path 'HKCU:\Software\MyApp' -Name 'TestValue' -Value 123 [OK]
Quick Trick: Set-ItemProperty uses -Name for value and -Value for data [OK]
Common Mistakes:
  • Swapping -Name and -Value parameters
  • Using Get-ItemProperty to set values
  • Using New-Item which creates keys, not values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes