From 69993fd8a2b938a1eba48913c9d36af7cc98aa61 Mon Sep 17 00:00:00 2001 From: Alexis Spencer Date: Wed, 23 Nov 2022 16:30:52 +1100 Subject: [PATCH] Changed to verbose --- Standard-CT-Module/CT-PS-Standard.psm1 | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/Standard-CT-Module/CT-PS-Standard.psm1 b/Standard-CT-Module/CT-PS-Standard.psm1 index 3c67466..3db1f05 100644 --- a/Standard-CT-Module/CT-PS-Standard.psm1 +++ b/Standard-CT-Module/CT-PS-Standard.psm1 @@ -120,16 +120,10 @@ Function Write-Transcript { [CmdletBinding()] Param( [Parameter(ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)] - $output, - [Parameter(ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)] - [switch] $NoNewLine + $output ) - if (Get-Variable VerboseOut -Scope Global -ValueOnly) { - if ($NoNewLine) { - Write-Host "$($output)" -NoNewline - } else { - Write-Host "$($output)" - } + if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) { + Write-Verbose "$($output)" } $output | Out-File -FilePath "$($Transcript_log)" -Append } @@ -140,16 +134,10 @@ Function Write-API-Log { [CmdletBinding()] Param( [Parameter(ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)] - $output, - [Parameter(ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)] - [switch] $NoNewLine + $output ) - if (Get-Variable VerboseOut -Scope Global -ValueOnly) { - if ($NoNewLine) { - Write-Host "$($output)" -NoNewline - } else { - Write-Host "$($output)" - } + if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) { + Write-Verbose "$($output)" } $output | Out-File -FilePath "$($API_log)" -Append }