导入模块位于网络共享上

发布于 2024-10-08 13:15:00 字数 598 浏览 6 评论 0原文

我有一个位于网络共享上的模块,我希望在远程会话期间加载到网络上的其他服务器。

这是我的命令:

enter-pssession remoteserver
import-module \\shareserver\sharefolder\SPModule.misc

这是错误:

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

模块无法从网络共享加载还是我做错了什么?

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

离不开的别离 2024-10-15 13:15:00

默认情况下,它会在 PSModulePath 环境变量中列出的任何路径中按名称查找模块。我知道你也可以提供绝对路径,但我从未尝试过 UNC。

也就是说,模块文件名以 .psm1、.psd1 或 .dll 结尾 - “.misc”不是有效的模块文件名。从帮助中:

Specifies the names of the modules to import. Enter the name of the module or the name of a file in the module, such as a .psd1, .psm1, .dll, or ps1 file. File paths are optional. Wildcards are not permitted. You can also pipe module names and file names to Import-Module.

If you omit a path, Import-Module looks for the module in the paths saved in the PSModulePath environment variable ($env:PSModulePath).

尝试将模块重命名为 .psm1 (如果它实际上是脚本模块)。

By default, it looks for modules by name in whatever path(s) are listed in the PSModulePath environment variable. I know you can also provide an absolute path, but I've never tried a UNC.

That said, module filenames end in either .psm1, .psd1, or .dll - ".misc" isn't a valid module filename. From the help:

Specifies the names of the modules to import. Enter the name of the module or the name of a file in the module, such as a .psd1, .psm1, .dll, or ps1 file. File paths are optional. Wildcards are not permitted. You can also pipe module names and file names to Import-Module.

If you omit a path, Import-Module looks for the module in the paths saved in the PSModulePath environment variable ($env:PSModulePath).

Try renaming your module to .psm1 (if it is in fact a Script Module).

七七 2024-10-15 13:15:00

当创建 PS 会话并通过 Kerberos 进行身份验证时,该会话不支持双跳。因此,PS会话无法利用网络资源进行认证。

解决:
在作为 Enter-PSSession 命令的目标的计算机上,运行以下命令:

> Enable-WSManCredSSP -Role Server

在运行 Enter-PSSession 命令的计算机上,运行以下命令:

> Enable-WSManCredSSP -Role Client -DelegateComputer Servername

参考:https://support.microsoft.com/af-za/help/4076842

When a PS session is created and authenticates through Kerberos, the session doesn't support double hop. Therefore, the PS session can't authenticate by using network resources.

Resolution:
On the computer that is the target of the Enter-PSSession command, run this command:

> Enable-WSManCredSSP -Role Server

On the computer on which you run the Enter-PSSession command, run this command:

> Enable-WSManCredSSP -Role Client -DelegateComputer Servername

Reference: https://support.microsoft.com/af-za/help/4076842

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文