RELOAD-MODULE.ps1

<#
.SYNOPSIS
    Reload the Intune AI module to get the latest version with CIS menu option
     
.DESCRIPTION
    This script removes and reimports the module to ensure you have the latest version
    with the CIS Benchmark Compliance menu option (section E).
     
.EXAMPLE
    .\RELOAD-MODULE.ps1
#>


Write-Host "Reloading Intune AI Module..." -ForegroundColor Cyan
Write-Host ""

# Remove module if loaded
$moduleName = "ai-enterprise-intune-compliance"
$loadedModule = Get-Module -Name $moduleName -ErrorAction SilentlyContinue
if ($loadedModule) {
    Write-Host "Removing existing module..." -ForegroundColor Yellow
    Remove-Module -Name $moduleName -Force -ErrorAction SilentlyContinue
    Write-Host "Module removed." -ForegroundColor Green
} else {
    Write-Host "Module not currently loaded." -ForegroundColor Gray
}

# Get module path
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
$modulePath = $scriptPath

# Reimport module
Write-Host "Importing module from: $modulePath" -ForegroundColor Yellow
try {
    Import-Module $modulePath -Force -ErrorAction Stop
    Write-Host "Module reloaded successfully!" -ForegroundColor Green
    Write-Host ""
    Write-Host "The CIS Benchmark Compliance option (section E) should now be visible in the menu." -ForegroundColor Cyan
    Write-Host ""
    Write-Host "Start the menu with:" -ForegroundColor Yellow
    Write-Host " Start-IntuneAIMenu" -ForegroundColor White
    Write-Host ""
} catch {
    Write-Error "Failed to reload module: $_"
    exit 1
}