AWS SSM ドキュメントの RunPowerShellScriptアクションを使用して、特定のアプリケーションが Windows サーバーにインストールされているかどうかを確認しようとしています。PowerShell スクリプトは非常に単純ですが、ドキュメントの検証は何度も失敗します。
PowerShell スクリプトには、列と円記号を含むレジストリ パスが含まれています。これが問題の一因になっている可能性があると思います。すべてのバックスラッシュをスラッシュに変更してみましたが、うまくいきませんでした。
schemaVersion: "2.2"
description: "Command Document to check if This Software is installed"
mainSteps:
- action: "aws:runPowerShellScript"
name: "CheckThisSoftware"
inputs:
runCommand:
- "$ResultMsg = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*).DisplayName -Contains 'Software Name Here'",
- "Write-Output $ResultMsg"
InvalidDocumentContent: null
ドキュメントを送信しようとする間、取得し続けます。