2011-09-20 73 views
1

我打電話簡單以下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中

但誤差保持持續。任何人都可以幫忙,因爲我已經用完所有谷歌選項。謝謝。

回答

6

由於錯誤提示,無法找到Get-CacheStatistics作爲cmdlet,函數,腳本文件或可操作程序。您需要安裝必要的模塊。

在這裏尋找如何加載必要的模塊指導運行的AppFabric的cmdlet:http://msdn.microsoft.com/en-us/library/ee677295.aspx

你可能要添加以下的進口(也許在你的腳本)的一種或多種:

Import-Module ApplicationServer 
Import-Module distributedcacheconfiguration 
Import-Module distributedcacheadministration 

執行策略與此錯誤無關,您正在運行腳本。

+0

是啊,這工作,運行的命令如下: powershell.exe -noexit -command 「導入模塊DistributedCacheAdministration;獲取-CacheStatistics」 謝謝 – Asterix

相關問題