From 0cfde7beae3bd750d117a2ebf062c66099d0ac32 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Tue, 8 Feb 2022 01:02:16 +0530 Subject: [PATCH] Fix adding Import-Module command to the profile in Install-PSPackage --- src/scripts/win32.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index a074f03c..020a1ced 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -166,10 +166,10 @@ Function Install-PSPackage() { Expand-Archive -Path $zip_file -DestinationPath $bin_dir -Force } Import-Module $module_path - Add-ToProfile $current_profile "$package-search" "Import-Module $module_path" - if($null -eq (Get-Command $cmdlet -ErrorAction SilentlyContinue)) { Install-Module -Name $package -Force + } else { + Add-ToProfile $current_profile "$package-search" "Import-Module $module_path" } }