reserve/Test-Example.ps1
function Test-Example { [CmdletBinding()] param ( [parameter()][string] $TestName = "Descriptive Name", [parameter()][string] $TestGroup = "configuration", [parameter()][string] $Description = "Description of this test", [parameter()][hashtable] $ScriptParams ) try { [System.Collections.Generic.List[PSObject]]$tempdata = @() # for detailed test output to return if needed $stat = "PASS" $msg = "No issues found" <# DELETE THIS COMMENT BLOCK WHEN FINISHED: perform test and return result as an object... Set $stat = "FAIL" only if test fails, or "WARNING" if not critical No need to set "PASS" since it is the default Set $msg = description of result #> } catch { $stat = 'ERROR' $msg = $_.Exception.Message -join ';' } finally { Write-Output $([pscustomobject]@{ TestName = $TestName TestGroup = $TestGroup TestData = $tempdata Description = $Description Status = $stat Message = $msg }) } } |