現在、powershell スクリプトを使用したインストールの問題で立ち往生しています。コマンドラインからホスト B で問題なくスクリプトを実行できます。しかし、リモートで起動しようとすると、スクリプトはログ ファイルを作成できません (コマンド ラインにパスワードを送信する必要がある場合に監視します)。エラーは一番下にあります...
ホスト A からインストーラーを起動します (以下のコマンドを参照)。ホスト B で PowerShell スクリプト cognosInstall.ps1 をリモートで実行します。スクリプト コードは一番下にあります。ファイルのコピーを開始してインストールを開始しますが、何らかの理由でログ ファイルの作成に問題があります。HostB のローカル ディレクトリを確認しましたが、ファイルも見つかりません。
ホスト A (データ コレクター): IBM Cognos をインストールする PowerShell スクリプトのリモート実行をトリガーします。
$s=new-pssession -computername HostB -credential $creds
invoke-command -session $s {$filename=Split-Path c:\temp\auto-install\*stats*.iso -leaf -resolve;echo $filename;}
invoke-command -session $s {c:\temp\auto-install\cognosInstall.ps1 $filename;}
ホスト B (Cognos をインストール中):
#Open a command window
invoke-item C:\Windows\System32\cmd.exe
start-sleep -s 2
# Write output of install command to file
select-window cmd |send-keys "c:\temp\cognos-install\cognos_install.bat c:\temp\cognos-install\cognos_mssql.ini C:\temp\IBM_Cognos_10.1.1_and_FP1 > c:\temp\Cognos_Install_log 2>&1 {ENTER}"
#check file for password prompt
do {
Start-Sleep -s 8;
write-output "Waiting for Password Prompt"
}
until (Select-string -Path c:\temp\Cognos_Install_Log -pattern Password )
select-window cmd |send-keys "Passwd123{ENTER}"
私が得ているエラー: インストールが実行を開始します.....そして、この問題が発生します.....
Copying install config file to cognos-install directory
C:\temp\auto-install\cognos_mssql.ini
1 File(s) copied
Beginning of Cognos Install - wait for completion
Waiting for Password Prompt
Cannot find path 'C:\temp\Cognos_Install_Log' because it does not exist.
+ CategoryInfo : ObjectNotFound: (C:\temp\Cognos_Install_Log:Stri
ng) [Select-String], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.Selec
tStringCommand