Public/Logging/Invoke-KriticalUtcmCommand.ps1
|
<# .SYNOPSIS Kritical.UTCM wrapper over Microsoft365DSC helper Invoke-M365DSCCommand (category: Logging, module: M365DSCErrorHandler). .DESCRIPTION Thin delegating passthrough — logic stays in Microsoft365DSC upstream; Kritical.UTCM provides the friendly namespace + citation registration. Install-Module Microsoft365DSC -Scope CurrentUser BEFORE calling. .NOTES Category: Logging Module: M365DSCErrorHandler Params: 5 #> function Invoke-KriticalUtcmCommand { [CmdletBinding()] param( [Parameter(Mandatory)] [ScriptBlock] $ScriptBlock, [SwitchParameter] $SuppressNotFoundError, [SwitchParameter] $RetryOnNotFoundError, [Int32] $MaxRetries, [Int32] $BaseDelayInSeconds ) if (-not (Get-Command -Name 'Invoke-M365DSCCommand' -ErrorAction SilentlyContinue)) { throw '[KriticalUtcm] Invoke-M365DSCCommand not available — Install-Module Microsoft365DSC -Scope CurrentUser then re-run' } try { & 'Invoke-M365DSCCommand' @PSBoundParameters } catch { Write-Error ('[KriticalUtcm/Invoke-KriticalUtcmCommand] ' + 'Invoke-M365DSCCommand' + ' failed: ' + $_.Exception.Message) throw } } |