How should a PowerShell function return data for another command to consume?
Documentation: Microsoft Learn
Write structured objects to the success stream and keep display formatting outside the function.
Interview · Question 14 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
Write structured objects to the success stream and keep display formatting outside the function. Avoid mixing status strings into the same output stream unless they are intentionally part of the contract.
Show it concretely
[pscustomobject]@{ Computer='Server01';Reachable=$true }
Expect this follow-up
Where should verbose progress or diagnostic messages go?