电源外壳:导入模块 [英] Power shell: Import-Module
问题描述
我一直在尝试在win2008标准服务器上缓存应用程序结构。当我执行follwowing命令时,我得到:
Import-Module DistributedCacheAdministration
Import-Module:未加载指定的模块'DistributedCacheAdministration',因为在任何模块目录中均未找到有效的模块文件。
I have been trying to us the app fabric caching on a win2008 standard server. When I execute the follwowing command I get: Import-Module DistributedCacheAdministration Import-Module : The specified module 'DistributedCacheAdministration' was not loaded because no valid module file was found in any module directory.
此目录在哪里以及如何使用该模块
Where is this directory located and how can I use that module
另外,看来我有Powershell1。我不能似乎安装了powershell 2
Also, it appears that I have powershell 1. I cant seem to install powershell 2
推荐答案
模块及其命令仅是Powershell 2中的功能,因此可以确定重新运行此版本。我猜您很困惑,因为Powershell.exe位于 1.0目录中;
Modules and their commands is a feature in Powershell 2 only, so you can be quite certain you're running this version. I guess you're confused because the Powershell.exe is located in a "1.0" directory; that's only to make version 2.0 backwards compatible.
您需要指定要加载的模块的确切位置:Import-Module [-Force] path-to-module-文件`
You need to specify the exact location of the module to load: Import-Module [-Force] path-to-module-file`
更好的是通过 $ PSModulePath
环境变量提供它。尝试使用 Get-Module -ListAvailable
查看可用的模块。由于似乎没有列出您要加载的文件,因此请尝试将$ PSModulePath设置为包含模块文件的目录中的上方文件夹。
Even better is have it available via the $PSModulePath
environment variable. Try a Get-Module -ListAvailable
to see what modules are available. Since the one you're trying to load does not seem to be listed, try setting the $PSModulePath to the folder above the directory holding the module file.
如果对正确的模块路径感到满意,请通过计算机属性进行设置。
When you're satisfied with having the correct module path, set it via Computer Properties.
这篇关于电源外壳:导入模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!