how can i import module from my Doc/WindowPS/Modules when i started PS ISE as an admin ?

I need to start my PS iSE as administrator.

My modules are in my user path. when i pass the command
        Get-Module -ListAvailable
i dont have the list for my user.

i dont want to move my modules to a different location.

how can I import my modules ?


thank you in advance.

Toshi
Erwin PombettAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

footechCommented:
You should have the same paths available whether PS is run as admin or not.
Check the contents of $env:PSModulePath

If a path is missing you can add it.
#Save the current value in the $p variable.
$p = [Environment]::GetEnvironmentVariable('PSModulePath','User')
#Add the new path to the $p variable. Begin with a semi-colon separator.
$p += ";$Home\Documents\WindowsPowerShell\Modules"
#Add the paths in $p to the PSModulePath value.
[Environment]::SetEnvironmentVariable('PSModulePath',$p,'User')

Open in new window

Close and reopen your PS session and check $env:PSModulePath again.

See here for some more info.
http://wahlnetwork.com/2015/08/10/psmodulepath/

More good reading on modules.
https://technet.microsoft.com/en-us/%5Clibrary/Dd878350%28v=VS.85%29.aspx

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Erwin PombettAuthor Commented:
hello footech,

thank you for your reply,

if i use the following line the $p value is empty.
$p = [Environment]::GetEnvironmentVariable('PSModulePath','User')
i can fill the $p as follows:
$p=$env:PSModulePath.

samething for filling the PSModulePath back, i can only doit with

$env:PSModulePath=$p.


is it normal that i can not doing it the way you paste it.
both following command doesn't output any error when passed.

$p = [Environment]::GetEnvironmentVariable('PSModulePath','User')
[Environment]::SetEnvironmentVariable('PSModulePath',$p,'User')

do you have any idea that could avoid your commands to pass on my PSISE ?

thank you in advance.
footechCommented:
It's fine not to have anything as the result of [Environment]::GetEnvironmentVariable('PSModulePath','User').  By default that is blank.

As I mentioned, first you have to check $env:PSModulePath.  Is your path there?

If it's already there, then you don't have to add it.  The set command doesn't produce any output.

Have you tried the following command?
Get-Module -ListAvailable -All
Did you read the last link I provided?  Do you have the folders named correctly for your modules?
Erwin PombettAuthor Commented:
ok, every thing is working, i added the path to the PSModulePath and things are ok.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.