Skip to content

Instantly share code, notes, and snippets.

@rickthackeray
Last active May 18, 2022 15:35
Show Gist options
  • Save rickthackeray/da32e096f50ceb466db8fcdb60e195a7 to your computer and use it in GitHub Desktop.
Save rickthackeray/da32e096f50ceb466db8fcdb60e195a7 to your computer and use it in GitHub Desktop.
Template for a PowerShell cmdlet
# 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