的AppFabric PowerShell的错误“‘GET-CacheStatistics’一词未被识别为cmdlet的名称。”
问题描述:
我打电话简单以下PowerShell的命令的AppFabric:的AppFabric PowerShell的错误“‘GET-CacheStatistics’一词未被识别为cmdlet的名称。”
powershell -noexit c:\scripts\ApplyClusterConfig.ps1
和脚本只包含:
Get-CacheStatistics
,我发现了以下错误:
The term 'Get-CacheStatistics' is not recognized as the name of a cmdlet, funct
ion, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At C:\scripts\ApplyClusterConfig.ps1:1 char:20
+ Get-CacheStatistics <<<<
+ CategoryInfo : ObjectNotFound: (Get-CacheStatistics:String) [],
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我做everyting,我可以科幻。第二网络包括
Set-ExecutionPolicy Unrestricted
和使用上的\来引用文件:
powershell -noexit .\ApplyClusterConfig.ps1
,并设置环境路径包括C:\ Scripts中
但误差保持持续。任何人都可以帮忙,因为我已经用完所有谷歌选项。谢谢。
答
由于错误提示,无法找到Get-CacheStatistics
作为cmdlet,函数,脚本文件或可操作程序。您需要安装必要的模块。
在这里寻找如何加载必要的模块指导运行的AppFabric的cmdlet:http://msdn.microsoft.com/en-us/library/ee677295.aspx
你可能要添加以下的进口(也许在你的脚本)的一种或多种:
Import-Module ApplicationServer
Import-Module distributedcacheconfiguration
Import-Module distributedcacheadministration
执行策略与此错误无关,您正在运行脚本。
是啊,这工作,运行的命令如下: powershell.exe -noexit -command “导入模块DistributedCacheAdministration;获取-CacheStatistics” 谢谢 – Asterix