PoshSonarr.psm1
$majorRev = $PSVersionTable.PSVersion.Major switch ($majorRev) { 7 { $binaries = "$PSScriptRoot\Core\netcoreapp3.1" $main = "MG.Sonarr-Core.dll" } 6 { $binaries = "$PSScriptRoot\Core\netcoreapp2.1" $main = "MG.Sonarr-Core.dll" } default { $binaries = "$PSScriptRoot\DotNet" $main = "MG.Sonarr.dll" } } Get-ChildItem -Path $binaries -Exclude $main -Recurse | ForEach-Object { Import-Module $_.FullName -ErrorAction Stop } Import-Module "$binaries\$main" -ErrorAction Stop |