Currently we are installing some modules using the command below, but it installs modules in C:\Program Files\WindowsPowerShell\Modules.
Install-Module -Name XXX -RequiredVersion XXX -Repository XXX -Scope AllUsers
Our requirement is to install this module in the E:\Modules folder. For that I updated the PSModulePath environment variable as below. (https://msdn.microsoft.com/en-us/library/dd878350(v=vs.85).aspx)
$p = [Environment]::GetEnvironmentVariable("PSModulePath")
$p += ";E:\Modules"
[Environment]::SetEnvironmentVariable("PSModulePath",$p)
But it still installs in C:\Program Files\WindowsPowerShell\Modules.
How do I update PSModulePath to E:\Modules before installing modules?
$env:PSModulePath is an environment variable which is used to search for modules when you do
Import-Moduleand also to do module auto load from PS V3 onwards.if you go I through the help file for
Install-Module, I can't see an option to provide install path for module.So as a workaround, you could have a copy job based on the module name(same will be folder name for every module) to your custom path.
Regards,
Kvprasoon