Private/Remove-SpecPowerShellModule.ps1

Function Remove-SpecPowerShellModule {
    [cmdletbinding()]

    param (
        [string]$module
    )

    try {
        write-verbose "Removing module [$module] from memory"
        Remove-Module $module -Verbose:$false -Force -ea Stop -ev x
        write-verbose "Module successfully removed"
        return 0 #success
    } catch {
        Write-verbose "An error occured trying to remove the module"
        write-verbose "The error was: $x"
        return 1 #failed
    }
}