From ca3ca61f0e1c8357638ba17bb86a46f2d47c659a Mon Sep 17 00:00:00 2001 From: Alexis Spencer Date: Fri, 25 Nov 2022 10:30:30 +1100 Subject: [PATCH] CmdletBinding SupportsShouldProcess --- Standard-CT-Module/CT-PS-Standard.psm1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Standard-CT-Module/CT-PS-Standard.psm1 b/Standard-CT-Module/CT-PS-Standard.psm1 index 491bef7..05787f3 100644 --- a/Standard-CT-Module/CT-PS-Standard.psm1 +++ b/Standard-CT-Module/CT-PS-Standard.psm1 @@ -14,7 +14,7 @@ trap { } function Initialize-Script { - [CmdletBinding()] + [CmdletBinding(SupportsShouldProcess)] param() <# ---- STANDARD SCRIPT BLOCK ---- @@ -140,7 +140,7 @@ function Initialize-Script { } Function Write-Log { - [CmdletBinding()] + [CmdletBinding(SupportsShouldProcess)] Param( [Parameter(ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)] $output @@ -168,7 +168,7 @@ Function Write-APILog { Function Request-Download { # Downloads a file using BITS if possible, and if BITS is not available, downloads directly from URL - [CmdletBinding()] + [CmdletBinding(SupportsShouldProcess)] Param( [Parameter(ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True, Mandatory = $true)] [string[]] $FILE_URL, @@ -230,6 +230,9 @@ Function Request-Download { function Get-CurrentLineNumber { + # Downloads a file using BITS if possible, and if BITS is not available, downloads directly from URL + [CmdletBinding(SupportsShouldProcess)] + param() return "$(Get-ChildItem $MyInvocation.ScriptLineNumber)" }