diff --git a/CHANGELOG.md b/CHANGELOG.md index 842fcde..a748a6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Placeholder for upcoming changes. ### Fixed - Bug in Save-SafeCreds.ps1 preventing execution of the script fixed +- Bug in SendEmailReport-Mailkit preventing the import Send-MailKitMessage module ## [2.0.0] - 2025-10-27 diff --git a/Functions.ps1 b/Functions.ps1 index 26a5f9d..5e4a448 100644 --- a/Functions.ps1 +++ b/Functions.ps1 @@ -558,9 +558,10 @@ function SendEmailReport-Mailkit if (!(Get-Module -ListAvailable -Name "Send-MailKitMessage")) { Write-Host -ForegroundColor Yellow "Send-MailKitMessage module missing, installing..." - Install-Module -Name "Send-MailKitMessage" -Scope CurrentUser -Force - Import-Module -Name "Send-MailKitMessage" + Install-Module -Name "Send-MailKitMessage" -Scope CurrentUser -Force } + + Import-Module -Name "Send-MailKitMessage" $UseSecureConnectionIfAvailable = $true diff --git a/README.md b/README.md index 019b400..db4974d 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ Defined in `GlobalVariables.ps1`: ## Usage ```powershell - '.\Hyper-V-Report.ps1' + 'powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\Hyper-V-Report.ps1' ``` Ensure all required variables and modules are properly configured before execution. @@ -114,7 +114,7 @@ To securely store SMTP credentials for email delivery, use the `Save-SafeCreds.p ### Usage ```powershell -'.\Save-SafeCreds.ps1' +'powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\Save-SafeCreds.ps1' ``` This script: