MSI をインストールするために実行しようとしている Windows Azure スタートアップ タスクがあります。powershell スクリプトを使用してタスクを実行しようとしています。次の場合、powershell スクリプトが実行されることを確認できます。
"Before powershell" >> C:\hello.txt
$msi = "E:\approot\bin\StartupScripts\AppInitalization_x64.msi"
if($true -eq [System.IO.File]::Exists($msi))
{
"file exists" >> C:\hello.txt
}
else
{
"file does not exist" >> C:\hello.txt
}
"After powershell" >> C:\hello.txt
展開を実行すると、hello.txt
「Before, file exists」と「after」が含まれます。
ただし、ファイルの存在条件を次のように変更しようとすると:
$arguments= ' /qn /l*v C:\AppInitalization_x64.txt'
Start-Process `
-file $msi `
-arg $arguments `
-passthru
展開がハングします (最大 5 時間待機させました)。マシンにリモート接続して同じ PowerShell スニペットを試すと、問題なくインストールされます。
これを起動スクリプトの一部として使用すると、なぜハングするのかについてのアイデアはありますか?