Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

292
Views
Powershell Module not automatically loaded for Linux container

I have a Powershell module that looks like this this:

function SayHello
{
    echo "hello"
}

I saved it as say-hello.psm1 and added it to a dockerfile like this:

COPY --chmod=0755 say-hello.psm1 /root/.local/share/powershell/Modules/say-hello.psm1

When I start the docker image up, and run SayHello it tells me that it can't find the command:

SayHello not recognized

But if I then run an Import-Module command and try it again, it works:

Can work if imported manually

I thought that maybe I had the wrong folder, but when I run $Env:PSModulePath I get /root/.local/share/powershell/Modules:/usr/local/share/powershell/Modules:/opt/microsoft/powershell/7/Modules. According to the documentation, that is where the modules should go. (I put it in the first one)

What do I need to do to make my powershell module work without needing to be manually imported?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I forgot that you need to put the psm1 file in a folder with the same name as the file (inside the Modules folder).

I did that and it started working just fine.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!