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:
- If I open an interactive PowerShell session as that user, the module loads automatically. I do not need to import it.
- 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
- 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!