From 724a7bcf97f8737f1bc9e5d6355e18227b985c99 Mon Sep 17 00:00:00 2001 From: Bear Date: Fri, 31 May 2019 13:57:55 +0200 Subject: [PATCH] Update WindowsCompatibility.psm1 Maybe not the best fix, but it helps to use it with Visual Studio Code --- .../WindowsCompatibility.psm1 | 40 +++++++++++++++---- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/WindowsCompatibility/WindowsCompatibility.psm1 b/WindowsCompatibility/WindowsCompatibility.psm1 index be01ccf..f938946 100644 --- a/WindowsCompatibility/WindowsCompatibility.psm1 +++ b/WindowsCompatibility/WindowsCompatibility.psm1 @@ -147,8 +147,11 @@ function Initialize-WinSession $PassThru ) - [bool] $verboseFlag = $PSBoundParameters['Verbose'] - + [bool] $verboseFlag = $false + if ($PSBoundParameters['Verbose']) + { + $verboseFlag = $true + } if ($ComputerName -eq ".") { $ComputerName = "localhost" @@ -380,7 +383,11 @@ function Get-WinModule $Full ) - [bool] $verboseFlag = $PSBoundParameters['Verbose'] + [bool] $verboseFlag = $false + if ($PSBoundParameters['Verbose']) + { + $verboseFlag = $true + } Write-Verbose -Verbose:$verboseFlag 'Connecting to compatibility session.' $initializeWinSessionParameters = @{ @@ -474,7 +481,11 @@ function Import-WinModule $PassThru ) - [bool] $verboseFlag = $PSBoundParameters['Verbose'] + [bool] $verboseFlag = $False + if ($PSBoundParameters['Verbose']) + { + $verboseFlag = $true + } Write-Verbose -Verbose:$verboseFlag "Connecting to compatibility session." $initializeWinSessionParameters = @{ @@ -585,7 +596,11 @@ function Compare-WinModule $Credential ) - [bool] $verboseFlag = $PSBoundParameters['Verbose'] + [bool] $verboseFlag = $false + if ($PSBoundParameters['Verbose']) + { + $verboseFlag = $true + } Write-Verbose -Verbose:$verboseFlag "Initializing compatibility session" $initializeWinSessionParameters = @{ @@ -650,7 +665,11 @@ function Copy-WinModule $Destination ) - [bool] $verboseFlag = $PSBoundParameters['Verbose'] + [bool] $verboseFlag = $false + if ($PSBoundParameters['Verbose']) + { + $verboseFlag = $true + } [bool] $whatIfFlag = $PSBoundParameters['WhatIf'] [bool] $confirmFlag = $PSBoundParameters['Confirm'] @@ -748,8 +767,12 @@ function Add-WindowsPSModulePath return } - [bool] $verboseFlag = $PSBoundParameters['Verbose'] - + [bool] $verboseFlag = $false + if ($PSBoundParameters['Verbose']) + { + $verboseFlag = $true + } + $paths = @( $Env:PSModulePath -split [System.IO.Path]::PathSeparator "${Env:UserProfile}\Documents\WindowsPowerShell\Modules" @@ -779,3 +802,4 @@ function Add-WindowsPSModulePath $Env:PSModulePath = $pathTable.Keys -join [System.IO.Path]::PathSeparator } +