Exceptions/New-ADCSIssuancePolicyInvalidOperationException.ps1
function New-ADCSIssuancePolicyInvalidOperationException { [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( [ADCSIssuancePolicyInvalidOperationException] $Message, 'ADCSIssuancePolicyInvalidOperationException', [System.Management.Automation.ErrorCategory]::ObjectNotFound, $null ) if ($Throw) { throw $ErrorRecord } $PSCmdlet.WriteObject($ErrorRecord) } } |