Skip to content

Instantly share code, notes, and snippets.

@vexx32
Created July 3, 2018 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vexx32/7dd113abceab7a2351300f829ad478c5 to your computer and use it in GitHub Desktop.
Save vexx32/7dd113abceab7a2351300f829ad478c5 to your computer and use it in GitHub Desktop.
function Select-Things {
[CmdletBinding()]
param(
[Parameter(Position = 0, Mandatory)]
[string[]]
$Param1
)
if ($Param1 -contains "one") {
switch ($Param1) {
"two" {
$Param1 -match "two"
}
"three" {
$Param1 -replace "three", "infinity"
}
default {
$Param1 | Where-Object {$_ -like '*ab*'}
throw "a ball"
}
}
}
else {
$PSCmdlet.ThrowTerminatingError("Requisite string not found.")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment