Last active
May 18, 2022 15:35
-
-
Save rickthackeray/da32e096f50ceb466db8fcdb60e195a7 to your computer and use it in GitHub Desktop.
Template for a PowerShell cmdlet
This file contains hidden or 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
# Below is the syntax for Get-Help compatibility | |
<# | |
.SYNOPSIS | |
Write something here. | |
.DESCRIPTION | |
Write something here. | |
.NOTES | |
Write something here. | |
.EXAMPLE | |
Paste example here. | |
.EXAMPLE | |
Paste another example here. | |
#> | |
Function Verb-Noun { | |
[CmdletBinding()] | |
Param( | |
[Parameter( | |
Position=0, | |
Mandatory=$True, | |
ValueFromPipeline=$True, | |
HelpMessage="Basic help message here")] | |
[string]$FirstParameter, | |
[switch]$SecondParameter, | |
[switch]$ThirdParameter | |
) | |
Process { | |
# Do stuff here | |
Write-Verbose "optional verbose output is nice" | |
$props = [ordered]@{ | |
one = $thing1 | |
two = $thing2 | |
} | |
$obj = New-Object -TypeName PSObject -Property $props | |
Write-Output $obj | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment