簡體   English   中英

使用 SSM 文檔檢查特定的應用程序安裝

[英]Use SSM Document to check a particular application installation

我正在嘗試使用 AWS SSM Document 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

我通過 escaping 我的特殊字符 (\) 修復了這個問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM