1

次の単純な Powershell AppFabric コマンドを呼び出しています。

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

私はウェブ上で見つけることができるすべてのことをしました

Set-ExecutionPolicy Unrestricted

.\ を使用してファイルを参照します。

powershell -noexit .\ApplyClusterConfig.ps1

c:\Scripts を含むように環境パスを設定します。

しかし、エラーは持続し続けます。私はすべてのGoogleオプションを使い果たしたので、誰でも助けてもらえますか. ありがとう。

4

1 に答える 1

6

エラーが示すようにGet-CacheStatistics、コマンドレット、関数、スクリプト ファイル、または操作可能なプログラムとして見つけることができません。必要なモジュールをロードする必要があります。

AppFabric コマンドレットを実行するために必要なモジュールをロードする方法に関するガイダンスについては、http://msdn.microsoft.com/en-us/library/ee677295.aspx を参照してください。

おそらく、次のインポートの 1 つまたは複数を追加する必要があります (スクリプト内にある可能性があります)。

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

実行ポリシーはこのエラーとは関係なく、スクリプトを正常に実行しています。

于 2011-09-20T16:03:09.583 に答える