

のバージョン 5 (V5) AWS Tools for PowerShell がリリースされました。

重要な変更とアプリケーションの移行については、[「移行トピック](https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html)」を参照してください。

 [https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html](https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html)

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# Directory Service Tools for PowerShell V5 を使用した の例
<a name="powershell_directory-service_code_examples"></a>

次のコード例は、 で AWS Tools for PowerShell V5 を使用してアクションを実行し、一般的なシナリオを実装する方法を示しています Directory Service。

*アクション*はより大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。アクションは個々のサービス機能を呼び出す方法を示していますが、コンテキスト内のアクションは、関連するシナリオで確認できます。

各例には完全なソースコードへのリンクが含まれており、コードの設定方法と実行方法に関する手順を確認できます。

**Topics**
+ [アクション](#actions)

## アクション
<a name="actions"></a>

### `Add-DSIpRoute`
<a name="directory-service_AddIpRoutes_powershell_topic"></a>

次のコード例は、`Add-DSIpRoute` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: このコマンドは、指定 Directory-id に割り当てられたリソースタグを削除します**  

```
Add-DSIpRoute -DirectoryId d-123456ijkl -IpRoute @{CidrIp ="203.0.113.5/32"} -UpdateSecurityGroupForDirectoryController $true
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[AddIpRoutes](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Add-DSResourceTag`
<a name="directory-service_AddTagsToResource_powershell_topic"></a>

次のコード例は、`Add-DSResourceTag` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: このコマンドは、指定の Directory-id にリソースタグを追加します。**  

```
Add-DSResourceTag -ResourceId d-123456ijkl -Tag @{Key="myTag"; Value="mytgValue"}
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[AddTagsToResource](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Approve-DSTrust`
<a name="directory-service_VerifyTrust_powershell_topic"></a>

次のコード例は、`Approve-DSTrust` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、指定された Trustid の AWS Directory Service VerifyTrust API オペレーションを呼び出します。**  

```
Approve-DSTrust -TrustId t-9067157123
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[VerifyTrust](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Confirm-DSSharedDirectory`
<a name="directory-service_AcceptSharedDirectory_powershell_topic"></a>

次のコード例は、`Confirm-DSSharedDirectory` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、ディレクトリ所有者から送信されたディレクトリ共有リクエストを受け入れます AWS アカウント。**  

```
Confirm-DSSharedDirectory -SharedDirectoryId d-9067012345
```
**出力:**  

```
CreatedDateTime     : 12/30/2019 4:20:27 AM
LastUpdatedDateTime : 12/30/2019 4:21:40 AM
OwnerAccountId      : 123456781234
OwnerDirectoryId    : d-123456ijkl
SharedAccountId     : 123456784321
SharedDirectoryId   : d-9067012345
ShareMethod         :
ShareNotes          : This is test sharing
ShareStatus         : Sharing
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[AcceptSharedDirectory](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Connect-DSDirectory`
<a name="directory-service_ConnectDirectory_powershell_topic"></a>

次のコード例は、`Connect-DSDirectory` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、オンプレミスディレクトリに接続するための AD Connector を作成します。**  

```
Connect-DSDirectory -Name contoso.com -ConnectSettings_CustomerUserName Administrator -Password $Password -ConnectSettings_CustomerDnsIp 172.31.36.96 -ShortName CONTOSO -Size Small -ConnectSettings_VpcId vpc-123459da -ConnectSettings_SubnetId subnet-1234ccaa, subnet-5678ffbb
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の[ConnectDirectory](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Deny-DSSharedDirectory`
<a name="directory-service_RejectSharedDirectory_powershell_topic"></a>

次のコード例は、`Deny-DSSharedDirectory` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、ディレクトリ所有者アカウントから送信されたディレクトリ共有リクエストを拒否します。**  

```
Deny-DSSharedDirectory -SharedDirectoryId d-9067012345
```
**出力:**  

```
d-9067012345
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の[RejectSharedDirectory](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Disable-DSDirectoryShare`
<a name="directory-service_UnshareDirectory_powershell_topic"></a>

次のコード例は、`Disable-DSDirectoryShare` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、ディレクトリ所有者とコンシューマーアカウントの間のディレクトリ共有を停止します。**  

```
Disable-DSDirectoryShare -DirectoryId d-123456ijkl -UnshareTarget_Id 123456784321 -UnshareTarget_Type ACCOUNT
```
**出力:**  

```
d-9067012345
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の[UnshareDirectory](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Disable-DSLDAPS`
<a name="directory-service_DisableLDAPS_powershell_topic"></a>

次のコード例は、`Disable-DSLDAPS` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、指定ディレクトリの LDAP セキュアコールを非アクティブ化します。**  

```
Disable-DSLDAPS -DirectoryId d-123456ijkl -Type Client
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DisableLDAPS](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Disable-DSRadius`
<a name="directory-service_DisableRadius_powershell_topic"></a>

次のコード例は、`Disable-DSRadius` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、AD Connector または Microsoft AD ディレクトリ用に設定された RADIUS サーバーを無効にします。**  

```
Disable-DSRadius -DirectoryId d-123456ijkl
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DisableRadius](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Disable-DSSso`
<a name="directory-service_DisableSso_powershell_topic"></a>

次のコード例は、`Disable-DSSso` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、ディレクトリのシングルサインオンを無効にします。**  

```
Disable-DSSso -DirectoryId d-123456ijkl
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DisableSso](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Enable-DSDirectoryShare`
<a name="directory-service_ShareDirectory_powershell_topic"></a>

次のコード例は、`Enable-DSDirectoryShare` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、Handshake メソッドを使用して AWS 、アカウント内の指定されたディレクトリを別の AWS アカウントと共有します。 **  

```
Enable-DSDirectoryShare -DirectoryId d-123456ijkl -ShareTarget_Id 123456784321 -ShareMethod HANDSHAKE -ShareTarget_Type ACCOUNT
```
**出力:**  

```
d-9067012345
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の[ShareDirectory](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Enable-DSLDAPS`
<a name="directory-service_EnableLDAPS_powershell_topic"></a>

次のコード例は、`Enable-DSLDAPS` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、指定ディレクトリのスイッチをアクティブ化して、常に LDAP セキュアコールを使用するようにします。**  

```
Enable-DSLDAPS -DirectoryId d-123456ijkl -Type Client
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[EnableLDAPS](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Enable-DSRadius`
<a name="directory-service_EnableRadius_powershell_topic"></a>

次のコード例は、`Enable-DSRadius` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、AD Connector または Microsoft AD ディレクトリ用に指定された RADIUS サーバー設定で多要素認証 (MFA) を有効にします。**  

```
Enable-DSRadius -DirectoryId d-123456ijkl 
-RadiusSettings_AuthenticationProtocol PAP 
-RadiusSettings_DisplayLabel Radius 
-RadiusSettings_RadiusPort 1812 
-RadiusSettings_RadiusRetry 4 
-RadiusSettings_RadiusServer 10.4.185.113 
-RadiusSettings_RadiusTimeout 50 
-RadiusSettings_SharedSecret wJalrXUtnFEMI
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[EnableRadius](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Enable-DSSso`
<a name="directory-service_EnableSso_powershell_topic"></a>

次のコード例は、`Enable-DSSso` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、ディレクトリのシングルサインオンを有効にします。 **  

```
Enable-DSSso -DirectoryId d-123456ijkl
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[EnableSso](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-DSCertificate`
<a name="directory-service_DescribeCertificate_powershell_topic"></a>

次のコード例は、`Get-DSCertificate` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、セキュリティ保護された LDAP 接続に登録された証明書に関する情報を表示します。**  

```
Get-DSCertificate -DirectoryId d-123456ijkl -CertificateId c-906731e34f
```
**出力:**  

```
CertificateId      : c-906731e34f
CommonName         : contoso-EC2AMAZ-CTGG2NM-CA
ExpiryDateTime     : 4/15/2025 6:34:15 PM
RegisteredDateTime : 4/15/2020 6:38:56 PM
State              : Registered
StateReason        : Certificate registered successfully.
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeCertificate](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-DSCertificateList`
<a name="directory-service_ListCertificates_powershell_topic"></a>

次のコード例は、`Get-DSCertificateList` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、指定ディレクトリのセキュリティ保護された LDAP 接続用に登録されたすべての証明書が一覧表示されます。**  

```
Get-DSCertificateList -DirectoryId d-123456ijkl
```
**出力:**  

```
CertificateId CommonName                 ExpiryDateTime       State
------------- ----------                 --------------       -----
c-906731e34f  contoso-EC2AMAZ-CTGG2NM-CA 4/15/2025 6:34:15 PM Registered
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[ListCertificates](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-DSConditionalForwarder`
<a name="directory-service_DescribeConditionalForwarders_powershell_topic"></a>

次のコード例は、`Get-DSConditionalForwarder` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: このコマンドは、指定 Directory-id の設定済みの条件付きフォワーダーをすべて取得します。**  

```
Get-DSConditionalForwarder -DirectoryId d-123456ijkl
```
**出力:**  

```
DnsIpAddrs      RemoteDomainName ReplicationScope
----------      ---------------- ----------------
{172.31.77.239} contoso.com      Domain
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeConditionalForwarders](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-DSDirectory`
<a name="directory-service_DescribeDirectories_powershell_topic"></a>

次のコード例は、`Get-DSDirectory` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: このコマンドは、このアカウントに属するディレクトリに関する情報を取得します。**  

```
Get-DSDirectory | Select-Object DirectoryId, Name, DnsIpAddrs, Type
```
**出力:**  

```
DirectoryId  Name           DnsIpAddrs                     Type
-----------  ----           ----------                     ----
d-123456abcd abcd.example.com {172.31.74.189, 172.31.13.145} SimpleAD
d-123456efgh wifi.example.com {172.31.16.108, 172.31.10.56}  ADConnector
d-123456ijkl lan2.example.com {172.31.10.56, 172.31.16.108}  MicrosoftAD
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeDirectories](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-DSDirectoryLimit`
<a name="directory-service_GetDirectoryLimits_powershell_topic"></a>

次のコード例は、`Get-DSDirectoryLimit` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、us-east-1 リージョンのディレクトリ制限情報を表示します。**  

```
Get-DSDirectoryLimit -Region us-east-1
```
**出力:**  

```
CloudOnlyDirectoriesCurrentCount : 1
CloudOnlyDirectoriesLimit        : 10
CloudOnlyDirectoriesLimitReached : False
CloudOnlyMicrosoftADCurrentCount : 1
CloudOnlyMicrosoftADLimit        : 20
CloudOnlyMicrosoftADLimitReached : False
ConnectedDirectoriesCurrentCount : 1
ConnectedDirectoriesLimit        : 10
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[GetDirectoryLimits](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-DSDomainControllerList`
<a name="directory-service_DescribeDomainControllers_powershell_topic"></a>

次のコード例は、`Get-DSDomainControllerList` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: このコマンドは、指定 directory-id に対して起動されたドメインコントローラーの詳細なリストを取得します。**  

```
Get-DSDomainControllerList -DirectoryId d-123456ijkl
```
**出力:**  

```
AvailabilityZone          : us-east-1b
DirectoryId               : d-123456ijkl
DnsIpAddr                 : 172.31.16.108
DomainControllerId        : dc-1234567aa6
LaunchTime                : 4/4/2019 4:53:43 AM
Status                    : Active
StatusLastUpdatedDateTime : 4/24/2019 1:37:54 PM
StatusReason              :
SubnetId                  : subnet-1234kkaa
VpcId                     : vpc-123459d

AvailabilityZone          : us-east-1d
DirectoryId               : d-123456ijkl
DnsIpAddr                 : 172.31.10.56
DomainControllerId        : dc-1234567aa7
LaunchTime                : 4/4/2019 4:53:43 AM
Status                    : Active
StatusLastUpdatedDateTime : 4/4/2019 5:14:31 AM
StatusReason              :
SubnetId                  : subnet-5678ffbb
VpcId                     : vpc-123459d
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeDomainControllers](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-DSEventTopic`
<a name="directory-service_DescribeEventTopics_powershell_topic"></a>

次のコード例は、`Get-DSEventTopic` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: このコマンドは、ディレクトリのステータスが変更されたときの通知用に設定された SNS トピックの情報を表示します。**  

```
Get-DSEventTopic -DirectoryId d-123456ijkl
```
**出力:**  

```
CreatedDateTime : 12/13/2019 11:15:32 AM
DirectoryId     : d-123456ijkl
Status          : Registered
TopicArn        : arn:aws:sns:us-east-1:123456781234:snstopicname
TopicName       : snstopicname
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeEventTopics](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-DSIpRouteList`
<a name="directory-service_ListIpRoutes_powershell_topic"></a>

次のコード例は、`Get-DSIpRouteList` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: このコマンドは、ディレクトリ IP ルーティングで設定されたパブリック IP アドレスブロックを取得します。**  

```
Get-DSIpRouteList -DirectoryId d-123456ijkl
```
**出力:**  

```
AddedDateTime       : 12/13/2019 12:27:22 PM
CidrIp              : 203.0.113.5/32
Description         : Public IP of On-Prem DNS Server
DirectoryId         : d-123456ijkl
IpRouteStatusMsg    : Added
IpRouteStatusReason :
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[ListIpRoutes](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-DSLDAPSSetting`
<a name="directory-service_DescribeLDAPSSettings_powershell_topic"></a>

次のコード例は、`Get-DSLDAPSSetting` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、指定ディレクトリの LDAP セキュリティのステータスを説明します。**  

```
Get-DSLDAPSSetting -DirectoryId d-123456ijkl
```
**出力:**  

```
LastUpdatedDateTime  LDAPSStatus LDAPSStatusReason
-------------------  ----------- -----------------
4/15/2020 6:51:03 PM Enabled     LDAPS is enabled successfully.
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeLDAPSSettings](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-DSLogSubscriptionList`
<a name="directory-service_ListLogSubscriptions_powershell_topic"></a>

次のコード例は、`Get-DSLogSubscriptionList` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: このコマンドは、指定 directory-id のログサブスクリプション情報を取得します。**  

```
Get-DSLogSubscriptionList -DirectoryId d-123456ijkl
```
**出力:**  

```
DirectoryId  LogGroupName                                        SubscriptionCreatedDateTime
-----------  ------------                                        ---------------------------
d-123456ijkl /aws/directoryservice/d-123456ijkl-lan2.example.com 12/14/2019 9:05:23 AM
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[ListLogSubscriptions](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-DSResourceTag`
<a name="directory-service_ListTagsForResource_powershell_topic"></a>

次のコード例は、`Get-DSResourceTag` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: このコマンドは、指定ディレクトリのすべてのタグを取得します。**  

```
Get-DSResourceTag -ResourceId d-123456ijkl
```
**出力:**  

```
Key   Value
---   -----
myTag myTagValue
```
+  API の詳細については、AWS Tools for PowerShell コマンドレットリファレンス (V5) の「[ListTagsForResource](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。**

### `Get-DSSchemaExtension`
<a name="directory-service_ListSchemaExtensions_powershell_topic"></a>

次のコード例は、`Get-DSSchemaExtension` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、Microsoft AD ディレクトリに適用されているすべてのスキーマ拡張を一覧表示します。**  

```
Get-DSSchemaExtension -DirectoryId d-123456ijkl
```
**出力:**  

```
Description                 : ManagedADSchemaExtension
DirectoryId                 : d-123456ijkl
EndDateTime                 : 4/12/2020 10:30:49 AM
SchemaExtensionId           : e-9067306643
SchemaExtensionStatus       : Completed
SchemaExtensionStatusReason : Schema updates are complete.
StartDateTime               : 4/12/2020 10:28:42 AM
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[ListSchemaExtensions](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-DSSharedDirectory`
<a name="directory-service_DescribeSharedDirectories_powershell_topic"></a>

次のコード例は、`Get-DSSharedDirectory` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、 AWS アカウントの共有ディレクトリを取得します。**  

```
Get-DSSharedDirectory -OwnerDirectoryId d-123456ijkl -SharedDirectoryId d-9067012345
```
**出力:**  

```
CreatedDateTime     : 12/30/2019 4:34:37 AM
LastUpdatedDateTime : 12/30/2019 4:35:22 AM
OwnerAccountId      : 123456781234
OwnerDirectoryId    : d-123456ijkl
SharedAccountId     : 123456784321
SharedDirectoryId   : d-9067012345
ShareMethod         : HANDSHAKE
ShareNotes          : This is a test Sharing
ShareStatus         : Shared
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeSharedDirectories](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-DSSnapshot`
<a name="directory-service_DescribeSnapshots_powershell_topic"></a>

次のコード例は、`Get-DSSnapshot` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: このコマンドは、このアカウントに属する指定ディレクトリのスナップショットに関する情報を取得します。**  

```
Get-DSSnapshot -DirectoryId d-123456ijkl
```
**出力:**  

```
DirectoryId : d-123456ijkl
Name        :
SnapshotId  : s-9064bd1234
StartTime   : 12/13/2019 6:33:01 PM
Status      : Completed
Type        : Auto

DirectoryId : d-123456ijkl
Name        :
SnapshotId  : s-9064bb4321
StartTime   : 12/9/2019 9:48:11 PM
Status      : Completed
Type        : Auto
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeSnapshots](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-DSSnapshotLimit`
<a name="directory-service_GetSnapshotLimits_powershell_topic"></a>

次のコード例は、`Get-DSSnapshotLimit` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: このコマンドは、指定ディレクトリの手動スナップショット制限を取得します。**  

```
Get-DSSnapshotLimit -DirectoryId d-123456ijkl
```
**出力:**  

```
ManualSnapshotsCurrentCount ManualSnapshotsLimit ManualSnapshotsLimitReached
--------------------------- -------------------- ---------------------------
0                           5                    False
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[GetSnapshotLimits](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Get-DSTrust`
<a name="directory-service_DescribeTrusts_powershell_topic"></a>

次のコード例は、`Get-DSTrust` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: このコマンドは、指定された directory-id 用に作成された信頼関係の情報を取得します。**  

```
Get-DSTrust -DirectoryId d-123456abcd
```
**出力:**  

```
CreatedDateTime          : 7/5/2019 4:55:42 AM
DirectoryId              : d-123456abcd
LastUpdatedDateTime      : 7/5/2019 4:56:04 AM
RemoteDomainName         : contoso.com
SelectiveAuth            : Disabled
StateLastUpdatedDateTime : 7/5/2019 4:56:04 AM
TrustDirection           : One-Way: Incoming
TrustId                  : t-9067157123
TrustState               : Created
TrustStateReason         :
TrustType                : Forest
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DescribeTrusts](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `New-DSAlias`
<a name="directory-service_CreateAlias_powershell_topic"></a>

次のコード例は、`New-DSAlias` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、ディレクトリのエイリアスを作成し、指定 directory-id にエイリアスを割り当てます。**  

```
New-DSAlias -DirectoryId d-123456ijkl -Alias MyOrgName
```
**出力:**  

```
Alias     DirectoryId
-----     -----------
myorgname d-123456ijkl
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[CreateAlias](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `New-DSComputer`
<a name="directory-service_CreateComputer_powershell_topic"></a>

次のコード例は、`New-DSComputer` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、新しい Active Directory コンピュータオブジェクトを作成します。**  

```
New-DSComputer -DirectoryId d-123456ijkl -ComputerName ADMemberServer -Password $Password
```
**出力:**  

```
ComputerAttributes                  ComputerId                                    ComputerName
------------------                  ----------                                    ------------
{WindowsSamName, DistinguishedName} S-1-5-21-1191241402-978882507-2717148213-1662 ADMemberServer
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[CreateComputer](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `New-DSConditionalForwarder`
<a name="directory-service_CreateConditionalForwarder_powershell_topic"></a>

次のコード例は、`New-DSConditionalForwarder` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、指定された AWS Directory-id に条件付きフォワーダーを作成します。 **  

```
New-DSConditionalForwarder -DirectoryId d-123456ijkl -DnsIpAddr 172.31.36.96,172.31.10.56 -RemoteDomainName contoso.com
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[CreateConditionalForwarder](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `New-DSDirectory`
<a name="directory-service_CreateDirectory_powershell_topic"></a>

次のコード例は、`New-DSDirectory` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、新しい Simple AD ディレクトリを作成します。**  

```
New-DSDirectory -Name corp.example.com -Password $Password -Size Small -VpcSettings_VpcId vpc-123459d -VpcSettings_SubnetIds subnet-1234kkaa,subnet-5678ffbb
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[CreateDirectory](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `New-DSLogSubscription`
<a name="directory-service_CreateLogSubscription_powershell_topic"></a>

次のコード例は、`New-DSLogSubscription` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、 AWS アカウントの指定の Amazon CloudWatch ロググループに Directory Service ドメインコントローラーセキュリティログをリアルタイムに転送するためのサブスクリプションを作成します。**  

```
New-DSLogSubscription -DirectoryId d-123456ijkl -LogGroupName /aws/directoryservice/d-123456ijkl-lan2.example.com
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[CreateLogSubscription](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `New-DSMicrosoftAD`
<a name="directory-service_CreateMicrosoftAD_powershell_topic"></a>

次のコード例は、`New-DSMicrosoftAD` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、 に新しい Microsoft AD Directory を作成します AWS クラウド。**  

```
New-DSMicrosoftAD -Name corp.example.com -Password $Password -edition Standard -VpcSettings_VpcId vpc-123459d -VpcSettings_SubnetIds subnet-1234kkaa,subnet-5678ffbb
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[CreateMicrosoftAD](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `New-DSSnapshot`
<a name="directory-service_CreateSnapshot_powershell_topic"></a>

次のコード例は、`New-DSSnapshot` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、ディレクトリスナップショットを作成します。**  

```
New-DSSnapshot -DirectoryId d-123456ijkl
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[CreateSnapshot](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `New-DSTrust`
<a name="directory-service_CreateTrust_powershell_topic"></a>

次のコード例は、`New-DSTrust` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、 AWS Managed Microsoft AD ディレクトリと既存のオンプレミス Microsoft Active Directory との間に双方向のフォレスト全体の信頼を作成します。**  

```
New-DSTrust -DirectoryId d-123456ijkl -RemoteDomainName contoso.com -TrustDirection Two-Way -TrustType Forest -TrustPassword $Password -ConditionalForwarderIpAddr 172.31.36.96
```
**出力:**  

```
t-9067157123
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[CreateTrust](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Register-DSCertificate`
<a name="directory-service_RegisterCertificate_powershell_topic"></a>

次のコード例は、`Register-DSCertificate` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、セキュリティで保護された LDAP 接続の証明書を登録します。**  

```
$Certificate = Get-Content contoso.cer -Raw
Register-DSCertificate -DirectoryId d-123456ijkl -CertificateData $Certificate
```
**出力:**  

```
c-906731e350
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[RegisterCertificate](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Register-DSEventTopic`
<a name="directory-service_RegisterEventTopic_powershell_topic"></a>

次のコード例は、`Register-DSEventTopic` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、ディレクトリをパブリッシャーとして SNS トピックに関連付けます。**  

```
Register-DSEventTopic -DirectoryId d-123456ijkl -TopicName snstopicname
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[RegisterEventTopic](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Remove-DSConditionalForwarder`
<a name="directory-service_DeleteConditionalForwarder_powershell_topic"></a>

次のコード例は、`Remove-DSConditionalForwarder` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、 AWS Direcotry 用に設定された条件付きフォワーダーを削除します。**  

```
Remove-DSConditionalForwarder -DirectoryId d-123456ijkl -RemoteDomainName contoso.com
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DeleteConditionalForwarder](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Remove-DSDirectory`
<a name="directory-service_DeleteDirectory_powershell_topic"></a>

次のコード例は、`Remove-DSDirectory` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、 AWS ディレクトリサービスディレクトリ (Simple AD/Microsoft AD/AD Connector) を削除します。**  

```
Remove-DSDirectory -DirectoryId d-123456ijkl
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DeleteDirectory](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Remove-DSIpRoute`
<a name="directory-service_RemoveIpRoutes_powershell_topic"></a>

次のコード例は、`Remove-DSIpRoute` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: このコマンドは、指定 IP を Directory-id の設定済み IP ルートから削除します。 **  

```
Remove-DSIpRoute -DirectoryId d-123456ijkl -CidrIp 203.0.113.5/32
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[RemoveIpRoutes](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Remove-DSLogSubscription`
<a name="directory-service_DeleteLogSubscription_powershell_topic"></a>

次のコード例は、`Remove-DSLogSubscription` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: このコマンドは、指定 Directory-id のログサブスクリプションを削除します**  

```
Remove-DSLogSubscription -DirectoryId d-123456ijkl
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DeleteLogSubscription](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Remove-DSResourceTag`
<a name="directory-service_RemoveTagsFromResource_powershell_topic"></a>

次のコード例は、`Remove-DSResourceTag` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: このコマンドは、指定 Directory-id に割り当てられたリソースタグを削除します**  

```
Remove-DSResourceTag -ResourceId d-123456ijkl -TagKey myTag
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[RemoveTagsFromResource](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Remove-DSSnapshot`
<a name="directory-service_DeleteSnapshot_powershell_topic"></a>

次のコード例は、`Remove-DSSnapshot` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、手動で作成されたスナップショットを削除します。**  

```
Remove-DSSnapshot -SnapshotId s-9068b488kc
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DeleteSnapshot](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Remove-DSTrust`
<a name="directory-service_DeleteTrust_powershell_topic"></a>

次のコード例は、`Remove-DSTrust` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、 AWS Managed AD Directory と外部ドメイン間の既存の信頼関係ヒントを削除します。**  

```
Get-DSTrust -DirectoryId d-123456ijkl -Select Trusts.TrustId | Remove-DSTrust
```
**出力:**  

```
t-9067157123
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DeleteTrust](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Reset-DSUserPassword`
<a name="directory-service_ResetUserPassword_powershell_topic"></a>

次のコード例は、`Reset-DSUserPassword` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、 AWS Managed microsoft AD または Simple AD Directory で ADUser という名前の Active Direcotry ユーザーのパスワードをリセットします。**  

```
Reset-DSUserPassword -UserName ADuser -DirectoryId d-123456ijkl -NewPassword $Password
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[ResetUserPassword](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Restore-DSFromSnapshot`
<a name="directory-service_RestoreFromSnapshot_powershell_topic"></a>

次のコード例は、`Restore-DSFromSnapshot` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、既存のディレクトリスナップショットを使用してディレクトリを復元します。**  

```
Restore-DSFromSnapshot -SnapshotId s-9068b488kc
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[RestoreFromSnapshot](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Set-DSDomainControllerCount`
<a name="directory-service_UpdateNumberOfDomainControllers_powershell_topic"></a>

次のコード例は、`Set-DSDomainControllerCount` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、指定 directory-id のドメインコントローラーの数を 3 に設定します。**  

```
Set-DSDomainControllerCount -DirectoryId d-123456ijkl -DesiredNumber 3
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[UpdateNumberOfDomainControllers](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Start-DSSchemaExtension`
<a name="directory-service_StartSchemaExtension_powershell_topic"></a>

次のコード例は、`Start-DSSchemaExtension` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、Microsoft AD ディレクトリにスキーマ拡張を適用します。**  

```
$ldif = Get-Content D:\Users\Username\Downloads\ExtendedSchema.ldf -Raw
Start-DSSchemaExtension -DirectoryId d-123456ijkl -CreateSnapshotBeforeSchemaExtension $true -Description ManagedADSchemaExtension -LdifContent $ldif
```
**出力:**  

```
e-9067306643
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[StartSchemaExtension](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Stop-DSSchemaExtension`
<a name="directory-service_CancelSchemaExtension_powershell_topic"></a>

次のコード例は、`Stop-DSSchemaExtension` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、Microsoft AD ディレクトリへの進行中のスキーマ拡張をキャンセルします。**  

```
Stop-DSSchemaExtension -DirectoryId d-123456ijkl -SchemaExtensionId e-9067306643
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[CancelSchemaExtension](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Unregister-DSCertificate`
<a name="directory-service_DeregisterCertificate_powershell_topic"></a>

次のコード例は、`Unregister-DSCertificate` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、セキュリティで保護された LDAP 接続用に登録された証明書をシステムから削除します。**  

```
Unregister-DSCertificate -DirectoryId d-123456ijkl -CertificateId c-906731e34f
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DeregisterCertificate](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Unregister-DSEventTopic`
<a name="directory-service_DeregisterEventTopic_powershell_topic"></a>

次のコード例は、`Unregister-DSEventTopic` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、指定された SNS トピックへの発行者として指定されたディレクトリを削除します。**  

```
Unregister-DSEventTopic -DirectoryId d-123456ijkl -TopicName snstopicname
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[DeregisterEventTopic](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Update-DSConditionalForwarder`
<a name="directory-service_UpdateConditionalForwarder_powershell_topic"></a>

次のコード例は、`Update-DSConditionalForwarder` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、 AWS ディレクトリ用に設定された条件付きフォワーダーを更新します。**  

```
Update-DSConditionalForwarder -DirectoryId d-123456ijkl -DnsIpAddr 172.31.36.96,172.31.16.108 -RemoteDomainName contoso.com
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[UpdateConditionalForwarder](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Update-DSRadius`
<a name="directory-service_UpdateRadius_powershell_topic"></a>

次のコード例は、`Update-DSRadius` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、AD Connector または Microsoft AD ディレクトリの RADIUS サーバー情報を更新します。**  

```
Update-DSRadius -DirectoryId d-123456ijkl -RadiusSettings_RadiusRetry 3
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[UpdateRadius](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

### `Update-DSTrust`
<a name="directory-service_UpdateTrust_powershell_topic"></a>

次のコード例は、`Update-DSTrust` を使用する方法を示しています。

**Tools for PowerShell V5**  
**例 1: この例では、指定 trust-id の SelectiveAuth パラメータを Disabled から Enabled に更新します。**  

```
Update-DSTrust -TrustId t-9067157123 -SelectiveAuth Enabled
```
**出力:**  

```
RequestId                            TrustId
---------                            -------
138864a7-c9a8-4ad1-a828-eae479e85b45 t-9067157123
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[UpdateTrust](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。