BitTitan.Runbooks.MSPComplete.Beta.psm1
<#
.SYNOPSIS PowerShell module for common MSPComplete functions and resources used in BitTitan Runbooks. .NOTES Version: 0.4.5 Last updated: 12 February 2019 Copyright (c) BitTitan, Inc. All rights reserved. Licensed under the MIT License. #> # Install/import BitTitan.Runbooks.Modules to bootstrap the install/import of the other modules Install-Module BitTitan.Runbooks.Modules -Scope CurrentUser -AllowClobber -Force Import-Module -Name "$($env:USERPROFILE)\Documents\WindowsPowerShell\Modules\BitTitan.Runbooks.Modules" -Force # Install/import external modules # Install/import the other BitTitan.Runbooks modules Import-BT_Module BitTitan.Runbooks.Common -Quiet # Check for SKIP_MSPC_TASK in any of the task string inputs Write-Information "Checking for SKIP_MSPC_TASK in the inputs." # This skips the execution of the entire task if 'SKIP_MSPC_TASK' is found in any of the string # inputs (case-insensitive). # This check is executed only if this task is not running on the local machine (i.e. running on # the MSPComplete platform). # The steps are: # Retrieve all MSPComplete input variables # Filter to keep string variables, # Concatenate them together, # Search for SKIP_MSPC_TASK in the combined string if (!$Global:PSDefaultParameterValues["*-BT_*:IsRunningOnLocalMachine"] -and (((ConvertTo-Array ((Get-BT_TaskInstance -Ticket $mspc.Ticket -Id $mspc.AutomationInstanceId).InputVariables) ` | ForEach-Object { Invoke-Expression "`$$($_.TaskDataName)" } ` | Where-Object { $_ -is [String] }) -join '') ` -match "SKIP_MSPC_TASK")) { Write-Information "'SKIP_MSPC_TASK' was found in the MSPComplete task string inputs. This task will be skipped." exit } |