text 编写Systems Manager合规性项目

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 编写Systems Manager合规性项目相关的知识,希望对你有一定的参考价值。

$managedInstanceId = (Get-Content -Path 'C:\ProgramData\Amazon\SSM\InstanceData\Vault\Store\RegistrationKey' -Raw | ConvertFrom-Json).instanceID
$moduleNames = @(
    'AWSPowerShell',
    'ClipboardText',
    'Convert',
    'PSWindowsUpdate'
)

$complianceItems = [System.Collections.Generic.List[Amazon.SimpleSystemsManagement.Model.ComplianceItemEntry]]::new()
foreach ($moduleName in $moduleNames)
{
    $module = Get-Module -Name $moduleName -ListAvailable | Sort-Object -Property Version -Descending | Select-Object -First 1

    $item = [Amazon.SimpleSystemsManagement.Model.ComplianceItemEntry]::new()
    $item.Id = $module.Version.ToString()
    $item.Severity = [Amazon.SimpleSystemsManagement.ComplianceSeverity]::INFORMATIONAL
    $item.Status = [Amazon.SimpleSystemsManagement.ComplianceStatus]::COMPLIANT
    $item.Title = $moduleName

    $null = $complianceItems.Add($item)
}

$writeSSMComplianceItem = @{
    ComplianceType = 'Custom:PowerShellModule'
    ResourceId = $managedInstanceId
    ResourceType = 'ManagedInstance'
    Item = $complianceItems
    ExecutionSummary_ExecutionTime = Get-Date
    ExecutionSummary_ExecutionType = 'Command'
}
Write-SSMComplianceItem @writeSSMComplianceItem

以上是关于text 编写Systems Manager合规性项目的主要内容,如果未能解决你的问题,请参考以下文章

powershell 编写Systems Manager库存记录

AWS Systems Manager Parameter Store 和 AWS Secrets Manager 之间的区别?

python 获取存储在EC2 Systems Manager中的Secure String参数

如何建立 AWs Systems Manager PortForwarding 会话?未知会话类型端口

text cooridnates_systems

Cloudera Manager介绍