I have a module located on a network share the I wish to load during remote session to other servers on my network.
Here my commands:
enter-pssession remoteserver
import-module \\shareserver\sharefolder\SPModule.misc
Here is the error:
Import-Module : The specified module 'SPModule.misc' was not loaded because no valid module file was found in any module directory.
+ CategoryInfo : ResourceUnavailable: (SPModule.misc:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
Are modules not able to load from network shares or what am I doing wrong?
Thanks
(Adding this as an answer to make it easier to find.)
You need to enable second-hop remoting with CredSSP.
PowerShell 2.0 remoting guide: Part 12 – Using CredSSP for multi-hop authentication