How would you design safe WhatIf and Confirm behavior in a function?
Documentation: Microsoft Learn
Use SupportsShouldProcess on an advanced function and call $PSCmdlet.ShouldProcess around the state-changing operation.
Interview · Question 17 of 34
Answer before reveal
Your draft
Write the answer you would give in an interview. The model answer stays hidden until you have drafted at least a short response.
A strong answer
Use SupportsShouldProcess on an advanced function and call $PSCmdlet.ShouldProcess around the state-changing operation. WhatIf previews the target and action; Confirm provides an approval prompt according to impact.
Show it concretely
Expect this follow-up
What limitations would you explain before calling WhatIf a complete safety guarantee?