Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

293
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda