Skip to content

Instantly share code, notes, and snippets.

@SteveL-MSFT
Created October 24, 2022 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SteveL-MSFT/2b21240a4532eaa57631c07e31a4a916 to your computer and use it in GitHub Desktop.
Save SteveL-MSFT/2b21240a4532eaa57631c07e31a4a916 to your computer and use it in GitHub Desktop.
write-progress -id 1 -Activity "Getting all modules"
$modules = find-module -Repository PSGallery
$moduleNames = $modules.Name
$fz = [System.Reflection.Assembly]::GetAssembly([System.Management.Automation.PowerShell]).GetType("System.Management.Automation.FuzzyMatcher")
$fzmatch = $fz.GetMethod("GetDamerauLevenshteinDistance")
$fzmatches = @{}
$i = 1
foreach ($module in $moduleNames) {
write-progress -id 1 -Activity "Searching" -Status "$module" -PercentComplete ([int32]([double]$i / [double]($moduleNames.Count) * 100))
foreach ($module2 in $moduleNames) {
if ($module -ne $module2) {
$distance = $fzmatch.Invoke($null, @($module, $module2))
if ($distance -lt 2) {
if (!$fzmatches[$module2] -eq $module) {
$fzmatches[$module] = $module2
write-host "$module, $module2"
}
}
}
}
$i++
}
$fzmatches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment