DPM サーバーへの接続を必要とする PowerShell スクリプトを実行しています。
Connect-DPMServer <DPM Server Name>
DPM 管理シェルからコマンドレットを実行すると、コマンドは成功し、サーバーに接続できます。
ただし、同じコマンドをスクリプトで囲み、DPM 管理シェルを介してスクリプトを呼び出すと、次のエラーが発生します。
The term 'Connect-DPMServer' is not recognized as the name of a cmdlet, function, 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.
+ CategoryInfo : ObjectNotFound: (Connect-DPMServer:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
のような他の DPM コマンドレットの場合も同様ですGet-DPMProtectionGroup
。
Windows Server 2008 R2 で Powershell バージョン 2.0 を実行しています。
この奇妙な動作の理由と、これを回避するにはどうすればよいですか?
編集
私が行ったいくつかの観察があります。私のスクリプトには 2 つの部分があります。ラッパー スクリプトと、ラッパー スクリプトによって独立したジョブとして呼び出されるヘルパー スクリプトです。
すべての DPM コマンドはラッパー スクリプトで識別されますが、ジョブとして実行されるヘルパー スクリプトでは識別されません。
これがなぜなのか、同じことを解決するための提案はありますか?