Skip to content

Instantly share code, notes, and snippets.

@manualbashing
Last active October 9, 2019 13:18
Show Gist options
  • Select an option

  • Save manualbashing/f77059454679eeeeaf351da5cb8ab3c3 to your computer and use it in GitHub Desktop.

Select an option

Save manualbashing/f77059454679eeeeaf351da5cb8ab3c3 to your computer and use it in GitHub Desktop.
Returns True if InputObject is a single object. False if it is null or a collection.
function ExactlyOne ($InputObject) {
(@($InputObject | Select-Object)).Count -eq 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment