

文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 [AWS SDK 範例](https://github.com/awsdocs/aws-doc-sdk-examples)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 搭配使用 `DescribeDocumentPermission` 與 CLI
<a name="ssm_example_ssm_DescribeDocumentPermission_section"></a>

下列程式碼範例示範如何使用 `DescribeDocumentPermission`。

------
#### [ CLI ]

**AWS CLI**  
**描述文件許可**  
下列 `describe-document-permission` 範例顯示有關公開共用之 Systems Manager 文件的許可詳細資訊。  

```
aws ssm describe-document-permission \
    --name "Example" \
    --permission-type "Share"
```
輸出：  

```
{
    "AccountIds": [
        "all"
    ],
    "AccountSharingInfoList": [
        {
            "AccountId": "all",
            "SharedDocumentVersion": "$DEFAULT"
        }
    ]
}
```
如需詳細資訊，請參閱《AWS Systems Manager 使用者指南》**中的 [Share a Systems Manager Document](https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-how-to-share.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DescribeDocumentPermission](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ssm/describe-document-permission.html)。

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**範例 1：此範例列出了文件的所有版本。**  

```
Get-SSMDocumentVersionList -Name "RunShellScript"
```
**輸出：**  

```
CreatedDate          DocumentVersion IsDefaultVersion Name
-----------          --------------- ---------------- ----
2/24/2017 5:25:13 AM 1               True             RunShellScript
```
+  如需 API 詳細資訊，請參閱《AWS Tools for PowerShell Cmdlet 參考 (V4)》**中的 [DescribeDocumentPermission](https://docs.aws.amazon.com/powershell/v4/reference)。

**Tools for PowerShell V5**  
**範例 1：此範例列出了文件的所有版本。**  

```
Get-SSMDocumentVersionList -Name "RunShellScript"
```
**輸出：**  

```
CreatedDate          DocumentVersion IsDefaultVersion Name
-----------          --------------- ---------------- ----
2/24/2017 5:25:13 AM 1               True             RunShellScript
```
+  如需 API 詳細資訊，請參閱《AWS Tools for PowerShell Cmdlet 參考 (V5)》**中的 [DescribeDocumentPermission](https://docs.aws.amazon.com/powershell/v5/reference)。

------