Tools/Clear-BCDevModule.ps1
function Clear-BCDevModule { param ( [Parameter( Mandatory = $false)] $Name ) $Modules = Get-InstalledModule $Name foreach ($Mod in $Modules) { $Latest = Get-InstalledModule $Mod.Name $SpecificMods = Get-InstalledModule $Mod.Name -allversions Write-Verbose "Module $($Mod.Name) found, latestversion $($Latest.Version)" foreach ($SubModule in $SpecificMods) { if ($SubModule.version -ne $Latest.version) { Write-Verbose " Uninstalling $($SubModule.Name) - $($SubModule.Version)" $SubModule | Uninstall-Module -Force } } } } Export-ModuleMember -Function Clear-BCDevModule |