Assets/Template-Boilerplate.ps1
|
<#
.SYNOPSIS Boilerplate template for Ops Jobs (PowerShell). #> param ( [string]$Arg1 ) # Utils are auto-loaded by JobRunner, but for local dev/testing: # Import-Module "C:\Ops\Bin\OpsUtils.psm1" -ErrorAction SilentlyContinue Write-OpsLog -Message "Starting Boilerplate Job..." -Level "INFO" Write-OpsLog -Message "Argument received: $Arg1" -Level "DEBUG" try { # Business Logic Here Write-OpsLog -Message "Doing work..." -Level "INFO" Start-Sleep -Seconds 1 # Example Error # throw "Something went wrong!" } catch { Write-OpsLog -Message "Error in logic: $_" -Level "ERROR" throw $_ # Re-throw to let JobRunner handle the failure } Write-OpsLog -Message "Boilerplate Job Finished." -Level "INFO" |