< Back

New-SmaScriptTask

Thu Jan 16, 2020 9:47 am

NAME New-SmaScriptTask



SYNOPSIS







SYNTAX

New-SmaScriptTask [-ScriptID] <Int32> [-Body] <Hashtable> [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

Creates a new script task for a given script ID. Works with online and offline kscripts.





PARAMETERS

-Body <Hashtable>

A hashtable-formatted payload with instructions for the task to create.



Required? true

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-ScriptID <Int32>

The ID of the script who's tasks you'd like information about.



Required? true

Position? 0

Default value 0

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

PSCustomObject







NOTES









-------------------------- EXAMPLE 1 --------------------------



$taskparams = @{

'attempts' = 2

'onFailure' = 'break'

'onRemediationFailure' = @(

@{

'id'= 27 # status ID

'params'= [ordered]@{

'type'='status'

'message'='this is a test message'

}

}

)

}



New-SmaScriptTask -ScriptID 1234 -Body $taskparams



Creates a new task for script ID 1234, gives it 2 attempts with a break on failure. On remediation failure, it

logs a status message.



RELATED LINKS

Online Version: https://github.com/ArtisanByteCrafter/K ... iptTask.md