Created
February 28, 2018 20:17
-
-
Save Sambardo/125d40db136c4926a121395f26be9f95 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()] | |
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