I used the variable $Env:PSModulePath , It provided two paths.
> C:\Users\My User\Documents\WindowsPowerShell\Modules
> C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
Seems like My User will be accessible only for me. But my module will be used by multiple person and also when uninstalling my application [I am installing my module via msi], even if some other user uninstalls it should be removed.
Can I use "C:\Windows\system32\WindowsPowerShell\v1.0\Modules\" for my application related module? Or is there any other better place ?
No. That place is not for you as noted in the section "Rules for Installing Modules" of the module installation guidelines.
You can decide yourself where you want to put the modules that are shared for multiple users.
Some options include:
Program Files
, and add that path toPSModulePath
.All Users
folder for example.You can also put your psm1 files on a shared drive. Then import the module with
You can find more info about adding a path to
PSModulePath
here.