Skip to content

Instantly share code, notes, and snippets.

@Sambardo
Created February 28, 2018 20:17
Show Gist options
  • Save Sambardo/125d40db136c4926a121395f26be9f95 to your computer and use it in GitHub Desktop.
Save Sambardo/125d40db136c4926a121395f26be9f95 to your computer and use it in GitHub Desktop.
Function MyFunction
{
[cmdletbinding()]
param([parameter(Mandatory,ParameterSetName="ServiceSet")]$service,
[parameter(Mandatory,ParameterSetName="ProcessSet")]$Process,
$Test)
Write-host "Service: $service" -ForegroundColor Green
Write-host "Process: $process" -ForegroundColor Yellow
Write-host "test: $test" -ForegroundColor Magenta
}
write-host "about to call with -service" -ForegroundColor Cyan
MyFunction -service alg -test hi
write-host "about to call with -process" -ForegroundColor Cyan
MyFunction -Process powershell -Test bye
write-host "about to call with -service and -process" -ForegroundColor Cyan
MyFunction -Process powershell -service alg -Test oops
write-host "about to call with NO PARAMS -- we will show you how to fix this soon" -ForegroundColor Cyan
MyFunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment