

Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh [SDK AWS Doc](https://github.com/awsdocs/aws-doc-sdk-examples). GitHub 

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# WorkSpaces contoh menggunakan Alat untuk PowerShell V5
<a name="powershell_5_workspaces_code_examples"></a>

Contoh kode berikut menunjukkan cara melakukan tindakan dan mengimplementasikan skenario umum dengan menggunakan Alat AWS untuk PowerShell V5 dengan WorkSpaces.

*Tindakan* merupakan kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Sementara tindakan menunjukkan cara memanggil fungsi layanan individual, Anda dapat melihat tindakan dalam konteks dalam skenario terkait.

Setiap contoh menyertakan tautan ke kode sumber lengkap, di mana Anda dapat menemukan instruksi tentang cara mengatur dan menjalankan kode dalam konteks.

**Topics**
+ [Tindakan](#actions)

## Tindakan
<a name="actions"></a>

### `Approve-WKSIpRule`
<a name="workspaces_AuthorizeIpRules_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Approve-WKSIpRule`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini menambahkan aturan ke Grup IP yang ada**  

```
$Rule = @(
@{IPRule = "10.1.0.0/0"; RuleDesc = "First Rule Added"},
@{IPRule = "10.2.0.0/0"; RuleDesc = "Second Rule Added"}
)

Approve-WKSIpRule -GroupId wsipg-abcnx2fcw -UserRule $Rule
```
+  Untuk detail API, lihat [AuthorizeIpRules](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Copy-WKSWorkspaceImage`
<a name="workspaces_CopyWorkspaceImage_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Copy-WKSWorkspaceImage`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini menyalin ruang kerja Gambar dengan ID tertentu dari us-west-2 ke wilayah saat ini dengan nama "” CopiedImageTest**  

```
Copy-WKSWorkspaceImage -Name CopiedImageTest -SourceRegion us-west-2 -SourceImageId wsi-djfoedhw6
```
**Output:**  

```
wsi-456abaqfe
```
+  Untuk detail API, lihat [CopyWorkspaceImage](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Edit-WKSClientProperty`
<a name="workspaces_ModifyClientProperties_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-WKSClientProperty`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini memungkinkan Rekoneksi untuk Klien Ruang Kerja**  

```
Edit-WKSClientProperty -Region us-west-2 -ClientProperties_ReconnectEnabled "ENABLED" -ResourceId d-123414a369
```
+  Untuk detail API, lihat [ModifyClientProperties](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Edit-WKSSelfServicePermission`
<a name="workspaces_ModifySelfservicePermissions_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-WKSSelfServicePermission`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini memungkinkan izin layanan mandiri untuk Mengubah jenis komputasi dan Meningkatkan Ukuran Volume untuk Direktori yang ditentukan**  

```
Edit-WKSSelfservicePermission -Region us-west-2 -ResourceId d-123454a369 -SelfservicePermissions_ChangeComputeType ENABLED -SelfservicePermissions_IncreaseVolumeSize ENABLED
```
+  Untuk detail API, lihat [ModifySelfservicePermissions](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Edit-WKSWorkspaceAccessProperty`
<a name="workspaces_ModifyWorkspaceAccessProperties_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-WKSWorkspaceAccessProperty`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini memungkinkan akses Workspace di Android dan Chrome OS untuk Direktori yang ditentukan**  

```
Edit-WKSWorkspaceAccessProperty -Region us-west-2 -ResourceId d-123454a369 -WorkspaceAccessProperties_DeviceTypeAndroid ALLOW -WorkspaceAccessProperties_DeviceTypeChromeOs ALLOW
```
+  Untuk detail API, lihat [ModifyWorkspaceAccessProperties](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Edit-WKSWorkspaceCreationProperty`
<a name="workspaces_ModifyWorkspaceCreationProperties_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-WKSWorkspaceCreationProperty`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini memungkinkan Akses Internet dan Mode Pemeliharaan menjadi true sebagai nilai default saat membuat Workspace**  

```
Edit-WKSWorkspaceCreationProperty -Region us-west-2 -ResourceId d-123454a369 -WorkspaceCreationProperties_EnableInternetAccess $true -WorkspaceCreationProperties_EnableMaintenanceMode $true
```
+  Untuk detail API, lihat [ModifyWorkspaceCreationProperties](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Edit-WKSWorkspaceProperty`
<a name="workspaces_ModifyWorkspaceProperties_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-WKSWorkspaceProperty`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mengubah Properti Workspace Running Mode menjadi Auto Stop untuk Workspace yang ditentukan**  

```
Edit-WKSWorkspaceProperty -WorkspaceId ws-w361s100v -Region us-west-2 -WorkspaceProperties_RunningMode AUTO_STOP
```
+  Untuk detail API, lihat [ModifyWorkspaceProperties](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Edit-WKSWorkspaceState`
<a name="workspaces_ModifyWorkspaceState_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-WKSWorkspaceState`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mengubah status Workspace yang ditentukan menjadi Tersedia**  

```
Edit-WKSWorkspaceState -WorkspaceId ws-w361s100v -Region us-west-2 -WorkspaceState AVAILABLE
```
+  Untuk detail API, lihat [ModifyWorkspaceState](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-WKSClientProperty`
<a name="workspaces_DescribeClientProperties_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-WKSClientProperty`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan Properti Klien dari Klien Workspace untuk Direktori yang ditentukan**  

```
Get-WKSClientProperty -ResourceId d-223562a123
```
+  Untuk detail API, lihat [DescribeClientProperties](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-WKSIpGroup`
<a name="workspaces_DescribeIpGroups_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-WKSIpGroup`.

**Alat untuk PowerShell V5**  
**Contoh 1: Sampel ini mendapatkan rincian Grup IP yang ditentukan di wilayah yang ditentukan**  

```
Get-WKSIpGroup -Region us-east-1 -GroupId wsipg-8m1234v45
```
**Output:**  

```
GroupDesc GroupId         GroupName UserRules
--------- -------         --------- ---------
          wsipg-8m1234v45 TestGroup {Amazon.WorkSpaces.Model.IpRuleItem, Amazon.WorkSpaces.Model.IpRuleItem}
```
+  Untuk detail API, lihat [DescribeIpGroups](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-WKSTag`
<a name="workspaces_DescribeTags_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-WKSTag`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mengambil tag untuk Workspace yang diberikan**  

```
Get-WKSTag -WorkspaceId ws-w361s234r -Region us-west-2
```
**Output:**  

```
Key         Value
---         -----
auto-delete no
purpose     Workbench
```
+  Untuk detail API, lihat [DescribeTags](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-WKSWorkspace`
<a name="workspaces_DescribeWorkspaces_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-WKSWorkspace`.

**Alat untuk PowerShell V5**  
**Contoh 1: Mengambil detail dari semua pipa Anda WorkSpaces .**  

```
Get-WKSWorkspace
```
**Output:**  

```
BundleId                    : wsb-1a2b3c4d
ComputerName                :
DirectoryId                 : d-1a2b3c4d
ErrorCode                   :
ErrorMessage                :
IpAddress                   :
RootVolumeEncryptionEnabled : False
State                       : PENDING
SubnetId                    :
UserName                    : myuser
UserVolumeEncryptionEnabled : False
VolumeEncryptionKey         :
WorkspaceId                 : ws-1a2b3c4d
WorkspaceProperties         : Amazon.WorkSpaces.Model.WorkspaceProperties
```
**Contoh 2: Perintah ini menunjukkan nilai properti anak `WorkSpaceProperties` untuk ruang kerja di `us-west-2` wilayah tersebut. Untuk informasi selengkapnya tentang properti anak`WorkSpaceProperties`, lihat https://docs.aws.amazon.com/workspaces/ latest/api/API \$1 WorkspaceProperties .html.**  

```
(Get-WKSWorkspace -Region us-west-2 -WorkSpaceId ws-xdaf7hc9s).WorkspaceProperties
```
**Output:**  

```
        ComputeTypeName                     : STANDARD
        RootVolumeSizeGib                   : 80
        RunningMode                         : AUTO_STOP
        RunningModeAutoStopTimeoutInMinutes : 60
        UserVolumeSizeGib                   : 50
```
**Contoh 3: Perintah ini menunjukkan nilai properti `RootVolumeSizeGib` anak `WorkSpaceProperties` untuk ruang kerja di `us-west-2` wilayah tersebut. Ukuran volume root, dalam GiB, adalah 80.**  

```
(Get-WKSWorkspace -Region us-west-2 -WorkSpaceId ws-xdaf7hc9s).WorkspaceProperties.RootVolumeSizeGib
```
**Output:**  

```
        80
```
+  Untuk detail API, lihat [DescribeWorkspaces](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-WKSWorkspaceBundle`
<a name="workspaces_DescribeWorkspaceBundles_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-WKSWorkspaceBundle`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mengambil rincian semua bundel Workspace di wilayah saat ini**  

```
Get-WKSWorkspaceBundle
```
**Output:**  

```
BundleId        : wsb-sfhdgv342
ComputeType     : Amazon.WorkSpaces.Model.ComputeType
Description     : This bundle is custom
ImageId         : wsi-235aeqges
LastUpdatedTime : 12/26/2019 06:44:07
Name            : CustomBundleTest
Owner           : 233816212345
RootStorage     : Amazon.WorkSpaces.Model.RootStorage
UserStorage     : Amazon.WorkSpaces.Model.UserStorage
```
+  Untuk detail API, lihat [DescribeWorkspaceBundles](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-WKSWorkspaceDirectory`
<a name="workspaces_DescribeWorkspaceDirectories_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-WKSWorkspaceDirectory`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mencantumkan detail direktori untuk direktori terdaftar**  

```
Get-WKSWorkspaceDirectory
```
**Output:**  

```
Alias                       : TestWorkspace
CustomerUserName            : Administrator
DirectoryId                 : d-123414a369
DirectoryName               : TestDirectory.com
DirectoryType               : MicrosoftAD
DnsIpAddresses              : {172.31.43.45, 172.31.2.97}
IamRoleId                   : arn:aws:iam::761234567801:role/workspaces_RoleDefault
IpGroupIds                  : {}
RegistrationCode            : WSpdx+4RRT43
SelfservicePermissions      : Amazon.WorkSpaces.Model.SelfservicePermissions
State                       : REGISTERED
SubnetIds                   : {subnet-1m3m7b43, subnet-ard11aba}
Tenancy                     : SHARED
WorkspaceAccessProperties   : Amazon.WorkSpaces.Model.WorkspaceAccessProperties
WorkspaceCreationProperties : Amazon.WorkSpaces.Model.DefaultWorkspaceCreationProperties
WorkspaceSecurityGroupId    : sg-0ed2441234a123c43
```
+  Untuk detail API, lihat [DescribeWorkspaceDirectories](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-WKSWorkspaceImage`
<a name="workspaces_DescribeWorkspaceImages_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-WKSWorkspaceImage`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mengambil semua detail semua gambar di wilayah tersebut**  

```
Get-WKSWorkspaceImage
```
**Output:**  

```
Description     :This image is copied from another image
ErrorCode       :
ErrorMessage    :
ImageId         : wsi-345ahdjgo
Name            : CopiedImageTest
OperatingSystem : Amazon.WorkSpaces.Model.OperatingSystem
RequiredTenancy : DEFAULT
State           : AVAILABLE
```
+  Untuk detail API, lihat [DescribeWorkspaceImages](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-WKSWorkspaceSnapshot`
<a name="workspaces_DescribeWorkspaceSnapshots_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-WKSWorkspaceSnapshot`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini menunjukkan stempel waktu snapshot terbaru yang dibuat untuk Workspace yang ditentukan**  

```
Get-WKSWorkspaceSnapshot -WorkspaceId ws-w361s100v
```
**Output:**  

```
RebuildSnapshots                   RestoreSnapshots
----------------                   ----------------
{Amazon.WorkSpaces.Model.Snapshot} {Amazon.WorkSpaces.Model.Snapshot}
```
+  Untuk detail API, lihat [DescribeWorkspaceSnapshots](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-WKSWorkspacesConnectionStatus`
<a name="workspaces_DescribeWorkspacesConnectionStatus_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-WKSWorkspacesConnectionStatus`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mengambil status koneksi untuk Workspace yang ditentukan**  

```
Get-WKSWorkspacesConnectionStatus -WorkspaceId ws-w123s234r
```
+  Untuk detail API, lihat [DescribeWorkspacesConnectionStatus](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `New-WKSIpGroup`
<a name="workspaces_CreateIpGroup_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-WKSIpGroup`.

**Alat untuk PowerShell V5**  
**Contoh 1: Sampel ini membuat grup Ip kosong bernama FreshEmptyIpGroup**  

```
New-WKSIpGroup -GroupName "FreshNewIPGroup"
```
**Output:**  

```
wsipg-w45rty4ty
```
+  Untuk detail API, lihat [CreateIpGroup](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `New-WKSTag`
<a name="workspaces_CreateTags_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-WKSTag`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini menambahkan tag baru ke ruang kerja bernama`ws-wsname`. Tag memiliki kunci “Nama”, dan nilai kunci dari`AWS_Workspace`.**  

```
$tag = New-Object Amazon.WorkSpaces.Model.Tag
$tag.Key = "Name"
$tag.Value = "AWS_Workspace"
New-WKSTag -Region us-west-2 -WorkspaceId ws-wsname -Tag $tag
```
**Contoh 2: Contoh ini menambahkan beberapa tag ke ruang kerja bernama`ws-wsname`. Satu tag memiliki kunci “Nama” dan nilai kunci`AWS_Workspace`; tag lainnya memiliki kunci tag “Tahap” dan nilai kunci “Uji”.**  

```
$tag = New-Object Amazon.WorkSpaces.Model.Tag
$tag.Key = "Name"
$tag.Value = "AWS_Workspace"

$tag2 = New-Object Amazon.WorkSpaces.Model.Tag
$tag2.Key = "Stage"
$tag2.Value = "Test"
New-WKSTag -Region us-west-2 -WorkspaceId ws-wsname -Tag $tag,$tag2
```
+  Untuk detail API, lihat [CreateTags](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `New-WKSWorkspace`
<a name="workspaces_CreateWorkspaces_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-WKSWorkspace`.

**Alat untuk PowerShell V5**  
**Contoh 1: Buat WorkSpace untuk bundel, direktori, dan pengguna yang disediakan.**  

```
New-WKSWorkspace -Workspace @{"BundleID" = "wsb-1a2b3c4d"; "DirectoryId" = "d-1a2b3c4d"; "UserName" = "USERNAME"}
```
**Contoh 2: Contoh ini membuat beberapa WorkSpaces**  

```
New-WKSWorkspace -Workspace @{"BundleID" = "wsb-1a2b3c4d"; "DirectoryId" = "d-1a2b3c4d"; "UserName" = "USERNAME_1"},@{"BundleID" = "wsb-1a2b3c4d"; "DirectoryId" = "d-1a2b3c4d"; "UserName" = "USERNAME_2"}
```
+  Untuk detail API, lihat [CreateWorkspaces](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Register-WKSIpGroup`
<a name="workspaces_AssociateIpGroups_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Register-WKSIpGroup`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendaftarkan Grup IP yang ditentukan dengan Direktori yang ditentukan**  

```
Register-WKSIpGroup -GroupId wsipg-23ahsdres -DirectoryId d-123412e123
```
+  Untuk detail API, lihat [AssociateIpGroups](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Register-WKSWorkspaceDirectory`
<a name="workspaces_RegisterWorkspaceDirectory_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Register-WKSWorkspaceDirectory`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendaftarkan direktori yang ditentukan untuk Workspaces Service**  

```
Register-WKSWorkspaceDirectory -DirectoryId d-123412a123 -EnableWorkDoc $false
```
+  Untuk detail API, lihat [RegisterWorkspaceDirectory](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Remove-WKSIpGroup`
<a name="workspaces_DeleteIpGroup_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-WKSIpGroup`.

**Alat untuk PowerShell V5**  
**Contoh 1: Sampel ini menghapus Grup IP yang ditentukan**  

```
Remove-WKSIpGroup -GroupId wsipg-32fhgtred
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-WKSIpGroup (DeleteIpGroup)" on target "wsipg-32fhgtred".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y
```
+  Untuk detail API, lihat [DeleteIpGroup](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Remove-WKSTag`
<a name="workspaces_DeleteTags_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-WKSTag`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini menghapus tag yang terkait dengan Workspace**  

```
Remove-WKSTag -ResourceId ws-w10b3abcd -TagKey "Type"
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-WKSTag (DeleteTags)" on target "ws-w10b3abcd".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y
```
+  Untuk detail API, lihat [DeleteTags](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Remove-WKSWorkspace`
<a name="workspaces_TerminateWorkspaces_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-WKSWorkspace`.

**Alat untuk PowerShell V5**  
**Contoh 1: Mengakhiri beberapa WorkSpaces. penggunaan sakelar -Force menghentikan cmdlet agar tidak meminta konfirmasi.**  

```
Remove-WKSWorkspace -WorkspaceId "ws-1a2b3c4d5","ws-6a7b8c9d0" -Force
```
**Contoh 2: Mengambil koleksi semua Anda WorkSpaces dan pipa IDs ke - WorkSpaceId parameter Remove-WKSWorkspace, mengakhiri semua. WorkSpaces Cmdlet akan meminta sebelum masing-masing WorkSpace dihentikan. Untuk menekan prompt konfirmasi tambahkan sakelar -Force.**  

```
Get-WKSWorkspaces | Remove-WKSWorkspace
```
**Contoh 3: Contoh ini menunjukkan cara meneruskan TerminateRequest objek yang mendefinisikan WorkSpaces yang akan dihentikan. Cmdlet akan meminta konfirmasi sebelum melanjutkan, kecuali parameter sakelar -Force juga ditentukan.**  

```
$arrRequest = @()
$request1 = New-Object Amazon.WorkSpaces.Model.TerminateRequest
$request1.WorkspaceId = 'ws-12345678'
$arrRequest += $request1
$request2 = New-Object Amazon.WorkSpaces.Model.TerminateRequest
$request2.WorkspaceId = 'ws-abcdefgh'
$arrRequest += $request2
Remove-WKSWorkspace -Request $arrRequest
```
+  Untuk detail API, lihat [TerminateWorkspaces](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Reset-WKSWorkspace`
<a name="workspaces_RebuildWorkspaces_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Reset-WKSWorkspace`.

**Alat untuk PowerShell V5**  
**Contoh 1: Membangun kembali yang ditentukan. WorkSpace**  

```
Reset-WKSWorkspace -WorkspaceId "ws-1a2b3c4d"
```
**Contoh 2: Mengambil koleksi semua Anda WorkSpaces dan pipa IDs ke - WorkSpaceId parameter Reset-WKSWorkspace, menyebabkan yang akan WorkSpaces dibangun kembali.**  

```
Get-WKSWorkspaces | Reset-WKSWorkspace
```
+  Untuk detail API, lihat [RebuildWorkspaces](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Restart-WKSWorkspace`
<a name="workspaces_RebootWorkspaces_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Restart-WKSWorkspace`.

**Alat untuk PowerShell V5**  
**Contoh 1: Reboot yang ditentukan WorkSpace.**  

```
Restart-WKSWorkspace -WorkspaceId "ws-1a2b3c4d"
```
**Contoh 2: Reboot beberapa WorkSpaces.**  

```
Restart-WKSWorkspace -WorkspaceId "ws-1a2b3c4d","ws-5a6b7c8d"
```
**Contoh 3: Mengambil koleksi semua Anda WorkSpaces dan pipa IDs ke - WorkSpaceId parameter Restart-WKSWorkspace, menyebabkan restart. WorkSpaces **  

```
Get-WKSWorkspaces | Restart-WKSWorkspace
```
+  Untuk detail API, lihat [RebootWorkspaces](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Stop-WKSWorkspace`
<a name="workspaces_StopWorkspaces_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Stop-WKSWorkspace`.

**Alat untuk PowerShell V5**  
**Contoh 1: Menghentikan beberapa WorkSpaces.**  

```
Stop-WKSWorkspace -WorkspaceId "ws-1a2b3c4d5","ws-6a7b8c9d0"
```
**Contoh 2: Mengambil koleksi semua Anda WorkSpaces dan pipa IDs ke - WorkSpaceId parameter Stop- WKSWorkspace WorkSpaces menyebabkan dihentikan.**  

```
Get-WKSWorkspaces | Stop-WKSWorkspace
```
**Contoh 3: Contoh ini menunjukkan cara melewati StopRequest objek yang mendefinisikan WorkSpaces yang akan dihentikan.**  

```
$arrRequest = @()
$request1 = New-Object Amazon.WorkSpaces.Model.StopRequest
$request1.WorkspaceId = 'ws-12345678'
$arrRequest += $request1
$request2 = New-Object Amazon.WorkSpaces.Model.StopRequest
$request2.WorkspaceId = 'ws-abcdefgh'
$arrRequest += $request2
Stop-WKSWorkspace -Request $arrRequest
```
+  Untuk detail API, lihat [StopWorkspaces](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Unregister-WKSIpGroup`
<a name="workspaces_DisassociateIpGroups_powershell_5_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Unregister-WKSIpGroup`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini membatalkan registrasi Grup IP yang ditentukan dari Direktori yang ditentukan**  

```
Unregister-WKSIpGroup -GroupId wsipg-12abcdphq -DirectoryId d-123454b123
```
+  Untuk detail API, lihat [DisassociateIpGroups](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 