Created
February 28, 2018 20:02
-
-
Save Sambardo/e1c0281af379642ff7062a81d53e745f 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(SupportsShouldProcess)] | |
param($service) | |
if($PSCmdlet.ShouldProcess($service,"Fetch service")) | |
{ | |
get-service -name $service | |
} | |
} | |
write-host "calling normally" -ForegroundColor Yellow | |
MyFunction -service alg | |
write-host "calling with whatif" -ForegroundColor Yellow | |
MyFunction -service alg -WhatIf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment