PoSH-SSH module only available when user is logged in.

Anonymous
2024-03-12T18:09:49+00:00

I use PoSH-SSH for a lot of automations. The problem is that the module is unavailable when scripts are run unless I am logged in and have a PowerShell session open as that user. Here is the behavior:

  1. If I open an interactive PowerShell session as that user, the module loads automatically. I do not need to import it.
  2. If I do get-module -listAvailable, it shows up with the locations where it is installed: C:\Windows\system32\WindowsPowerShell\v1.0\Modules, and C:\user\Documents\WindowsPowerShell\Modules
  3. If the script runs as the user, even if it performs import-module, it is unable to access the module unless I am logged in with a PowerShell session open as that user.

I am probably just missing something obvious, but any help would be greatly appreciated. Thanks!

Windows for business Windows Server Performance Windows desktop and shell experience

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question. To protect privacy, user profiles for migrated questions are anonymized.

0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-03-13T02:19:09+00:00

    Hello

    Thank you for posting in Microsoft Community forum.

    Based on the description, I understand your question is related to PowerShell script.

    Since there are no engineers dedicated to PowerShell script in this forum. in order to be able to get a quick and effective handling of your issue, I recommend that you repost your question in the Q&A forum, where there will be a dedicated engineer to give you a professional and effective reply.

    Here is the link for Q&A forum.

    Questions - Microsoft Q&A

    Click the "Ask a Question" button in the upper right corner to post your question and select any related tag.

    Thank you for your understanding and support. If you have any question or concern, please feel free to let us know.

    Have a nice day.

    Best Regards,

    Molly

    0 comments No comments