Private/Get-PstPublicFunction.ps1
function Get-PstPublicFunction { <# .SYNOPSIS Brief summary of function .DESCRIPTION Fuction description .PARAMETER Parameter (Required) or not? Describe parameter usuage .PARAMETER Parameter2 (Required) or not? Describe parameter usuage .EXAMPLE Give Examples of the function usuage .NOTES Any other notes the user may need to know bout the function .LINK Any Links with addtional information on the use of the function #> [CmdletBinding()] param ( [Parameter(Mandatory = $false, Position = 0, HelpMessage = "ParamterMessage")] [string]$Verb, [Parameter(Mandatory = $true, Position = 1, HelpMessage = "Paramter2Message")] [string]$Noun ) begin { Write-Debug -Message "Begin '$($MyInvocation.MyCommand.Name)' at '$(Get-Date)'" $result = @{} } process { try { Write-Information -Message "Parameter is '$($Parameter)'" Write-Information -Message "Parameter2 is '$($Parameter2)', if true write a warning, else write error and exit." if ($Parameter2) { Write-Warning -Message "Testing a Warning" }else { Write-Error -Message "Testing a Error" exit } Write-Output $result } catch { if ($_.Exception -and $_.Exception.Message) { Write-Error "An error occurred: $($_.Exception.Message)" } else { Write-Error "An error occurred, but no additional information is available." } } } end { if ($?) { Write-Debug -Message "End '$($MyInvocation.MyCommand.Name)' at '$(Get-Date)'" } } } |