Created
February 22, 2019 14:58
-
-
Save shaneis/0cd417a2964ca4f4582e96eab51590bf to your computer and use it in GitHub Desktop.
Get-Name with extra for ScriptBlock
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 Get-Name { | |
[CmdletBinding()] | |
param( | |
[String]$Name = 'you' | |
) | |
'Hello, {0}. Script root is {1}' -f $Name, $PSScriptRoot | |
} | |
Get-Name -Name Shane |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yup, looks good to me. Nice one!
I'll say that it may be difficult to get everyone in the company/community to use this style. Especially if they're starting with PowerShell and wondering "Why do I have to do this when I just want to run a script?!"
Overall, though, yup! An absolutely superb way to ensure these scripts are testable