Exceptions/New-ADCSTemplateAlreadyExistsException.ps1
function New-ADCSTemplateAlreadyExistsException { [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')] [CmdletBinding()] [OutputType([System.Management.Automation.ErrorRecord])] param( [Parameter( Mandatory )] [ValidateNotNullOrEmpty()] [string] $Message, [Parameter()] [switch] $Throw = $false ) end { [System.Management.Automation.ErrorRecord] $ErrorRecord = [System.Management.Automation.ErrorRecord]::new( [ADCSTemplateAlreadyExistsException] $Message, 'ADCSTemplateAlreadyExistsException', [System.Management.Automation.ErrorCategory]::ObjectNotFound, $null ) if ($Throw) { throw $ErrorRecord } $PSCmdlet.WriteObject($ErrorRecord) } } |