diff --git a/src/PSPreworkout/Public/Install-CommandNotFoundUtility.ps1 b/src/PSPreworkout/Public/Install-CommandNotFoundUtility.ps1 index 865136d..4122563 100644 --- a/src/PSPreworkout/Public/Install-CommandNotFoundUtility.ps1 +++ b/src/PSPreworkout/Public/Install-CommandNotFoundUtility.ps1 @@ -11,8 +11,8 @@ function Install-CommandNotFoundUtility { .NOTES Author: Sam Erde - Version: 0.1.0 - Modified: 2025-01-07 + Version: 0.1.1 + Modified: 2025-02-08 #> #requires -version 7.4 [CmdletBinding(HelpUri = 'https://day3bits.com/PSPreworkout/Install-CommandNotFoundUtility')] @@ -23,8 +23,13 @@ function Install-CommandNotFoundUtility { } # end begin block process { - Install-Module -Name Microsoft.WinGet.CommandNotFound -Scope CurrentUser try { + Install-Module -Name Microsoft.WinGet.CommandNotFound -Scope CurrentUser -Force + catch { + throw $_ + } + try { + # Might need to remove this to avoid errors during PSPreworkout installation. Import-Module -Name Microsoft.WinGet.CommandNotFound -ErrorAction SilentlyContinue } catch [System.InvalidOperationException] { Write-Warning -Message "Received the error `"$_`" while importing the 'Microsoft.WinGet.CommandNotFound module. The module may have already been installed and imported in the current session. This can usually be ignored.`n"