0

I'm trying to use AWS SSM Document RunPowerShellScript action to check if a particular application is installed on Windows servers. The PowerShell script is very simple, but Doucment validation keeps failing.

The PowerShell script does contain a registry path, which does contain columns and back slashes. I suspect this may contribute to the problem. Tried with changing all the back slashes to forward slashes with no luck.

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"

Keep getting InvalidDocumentContent: null while tries to submit the document.

Tomking Chen
  • 343
  • 3
  • 17

1 Answers1

1

I fixed this by escaping my special characters (\)

BOS
  • 311
  • 3
  • 4