How do I start a Powershell session with all imported modules?
1 answer
you can create a profile on a network share \\server\share\commonProfile.ps1
in this profile you define your path to the shared folder
if($env:PSModulePath -match "\\\\server\\share\\modules" -eq $false){
$env:PSModulePath = $env:PSModulePath + ";\\server\share\Modules"
}
Copy your modules to \\server\share\Modules
, you should now be able to do
$rs=new-pssession $computername
icm -Session $rs -ScriptBlock{. \\server\share\commonProfile.ps1} #dot source the profile
etsn $rs #enter remote session
#your modules should now be availables in the remote session :
get-module -listavailable
+4
source to share