I am using Azure DevOps to deploy PowerShell modules to a server. This release task deploys the modules to the directory C:\Windows\System32\WindowsPowerShell\v1.0\Modules\
. I am able to use the modules once they are deployed to this folder successfully.
If I modify one of the modules and re-release it the file in C:\Windows\System32\WindowsPowerShell\v1.0\Modules\
gets updated, however the old version of the module is still used when running from a batch file using pwsh
.
I discovered that the module file also exists in the following paths:
- C:\Program Files\PowerShell\Modules\
- C:\Program Files\PowerShell\6\Modules\
When deploying the new version using Azure DevOps the old version in the above two directories are not updated. Manually updating the module in those locations fixes the problem.
Why is the module file being copied into those two additional paths? Should those copies be overwritten when a new version of the module is deployed? What is the correct way of deploying a module in this scenario?