From c947b1edd45ec2061fa20ccd0e9bb20902f7fd99 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 18:54:35 +0000 Subject: [PATCH 1/2] Initial plan From bb704313f0995c4f99a639e6b1d3841d7a87582c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 18:56:02 +0000 Subject: [PATCH 2/2] Check if modules are already loaded before loading them (PR #56) Co-authored-by: kfosaaen <2163397+kfosaaen@users.noreply.github.com> --- MicroBurst.psm1 | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/MicroBurst.psm1 b/MicroBurst.psm1 index 157b3b4..218e0a2 100644 --- a/MicroBurst.psm1 +++ b/MicroBurst.psm1 @@ -5,8 +5,10 @@ $global:WarningPreference = 'SilentlyContinue' # Az try{ - Get-InstalledModule -ErrorAction Stop -Name Az | Out-Null - Import-Module Az -ErrorAction Stop + if (-not (Get-Module -Name Az)) { + Get-InstalledModule -ErrorAction Stop -Name Az | Out-Null + Import-Module Az -ErrorAction Stop + } Import-Module $PSScriptRoot\Az\MicroBurst-Az.psm1 $azStatus = "1" } @@ -16,16 +18,20 @@ catch{Write-Host -ForegroundColor DarkRed "Az module not installed, checking oth # AzureAD try{ - Get-InstalledModule -ErrorAction Stop -Name AzureAD | Out-Null - Import-Module AzureAD -ErrorAction Stop + if (-not (Get-Module -Name AzureAD)) { + Get-InstalledModule -ErrorAction Stop -Name AzureAD | Out-Null + Import-Module AzureAD -ErrorAction Stop + } Import-Module $PSScriptRoot\AzureAD\MicroBurst-AzureAD.psm1 } catch{Write-Host -ForegroundColor DarkRed "AzureAD module not installed, checking other modules"} <# AzureRm - Uncomment this section if you want to import the functions try{ - Get-InstalledModule -ErrorAction Stop -Name AzureRM | Out-Null - Import-Module AzureRM -ErrorAction Stop + if (-not (Get-Module -Name AzureRM)) { + Get-InstalledModule -ErrorAction Stop -Name AzureRM | Out-Null + Import-Module AzureRM -ErrorAction Stop + } Import-Module $PSScriptRoot\AzureRM\MicroBurst-AzureRM.psm1 } catch{ @@ -36,8 +42,10 @@ catch{ # MSOL try{ - Get-InstalledModule -ErrorAction Stop -Name msonline | Out-Null - Import-Module msonline -ErrorAction Stop + if (-not (Get-Module -Name msonline)) { + Get-InstalledModule -ErrorAction Stop -Name msonline | Out-Null + Import-Module msonline -ErrorAction Stop + } Import-Module $PSScriptRoot\MSOL\MicroBurst-MSOL.psm1 } catch{Write-Host -ForegroundColor DarkRed "MSOnline module not installed, checking other modules"}