Bird
0
0

What happens if you add two NoteProperties with the same name to a PowerShell object without using -Force?

hard📝 Conceptual Q10 of 15
PowerShell - Working with Objects
What happens if you add two NoteProperties with the same name to a PowerShell object without using -Force?
ABoth properties exist with the same name and different values
BThe second property overwrites the first silently
CPowerShell throws an error and does not add the second property
DThe object duplicates and creates two separate objects
Step-by-Step Solution
Solution:
  1. Step 1: Understand behavior of duplicate property names

    Without -Force, adding a property with an existing name causes an error.
  2. Step 2: Confirm other options are incorrect

    PowerShell does not silently overwrite without -Force, nor does it allow duplicate property names or duplicate objects.
  3. Final Answer:

    PowerShell throws an error and does not add the second property -> Option C
  4. Quick Check:

    Duplicate property without -Force causes error [OK]
Quick Trick: Use -Force to overwrite existing properties, else error occurs [OK]
Common Mistakes:
  • Assuming silent overwrite without -Force
  • Thinking duplicate properties can coexist

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes