Created
February 28, 2018 20:22
-
-
Save Sambardo/ec3393e0435ccf496f5ba315792ae7f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function MyFunction | |
{ | |
[cmdletbinding(DefaultParameterSetName="ProcessSet")] | |
param([parameter(Mandatory,ParameterSetName="ServiceSet")]$service, | |
[parameter(Mandatory,ParameterSetName="ProcessSet")]$Process, | |
$Test) | |
switch($PSCmdlet.ParameterSetName) | |
{ | |
"ServiceSet" {Write-host "Service: $service" -ForegroundColor Green} | |
"ProcessSet" {Write-host "Process: $process" -ForegroundColor Yellow} | |
} | |
if($test) | |
{ | |
Write-host "test: $test" -ForegroundColor Magenta | |
} | |
} | |
write-host "about to call with NO PARAMS" -ForegroundColor Cyan | |
MyFunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment