PowerShell V4 / Modules directory structure?

Recently i created a module, added it to azure devops.

Everything works great, I subscribe to the feed, added it as a repository (after additional problems required installing


I was able to get the module pulled down local and autoload great in v5.

However in v4 i wasnt seeing the module.

The directory was

C:\Program Files\WindowsPowershell\Modules\ModuleTest\\moduletest.psm1

I tried alot of things and finally thought what if i move it to

C:\Program Files\WindowsPowershell\Modules\ModuleTest\moduletest.psm1

I did this and life was happy, however i would like thoughts on best way to do this for all powershell versions and if possible without having to give up module version folder name.


Thank you


With a directory path ModuleTest<strong>\moduletest.psm1, the goal would be to have multiple versions under the same module? Typically, the PSM1 and PSD1 are in the root of the module directory. The module version is identified in the PSD1, not traditionally in the folder structure that is client-side. In the repo, there may be a version structure like\ModuleTest\moduletest.psm1, but the repository would just use that as the latest version.

Thank you for the reply Rob,

I was thinking that as well but following this article unless i misunderstood it it will work on v5 but the problem is prior it will not work.

So its like ok then how to separate v5 from prior version and do something at download so prior versions can see the modules.



Personally not had multiple versions under a single module, but I think the key is that you have to add references to the individual modules.

$p = [Environment]::GetEnvironmentVariable("PSModulePath")
$p += ";C:\Program Files\Fabrikam\Fabrikam8;C:\Program Files\Fabrikam\Fabrikam9"

Powershell 5 module search may parse this structure without adding the entries above, but Powershell 4 or lower need specific references for additional roots to search. My guess is the logic is Powershell is doing a Get-ChildItem search in Powershell 4 and Powershell 5 is doing a -Recursive search for modules.