A guided script makes Amazon WorkSpaces deployment at scale simple

Adoption of virtual desktops is on the rise as employees continue to work remotely in all sectors. But even when employees are in the office, Amazon WorkSpaces ends the need to buy and deploy hardware or install complex software and reduces the burden on IT teams. Users can be added or removed quickly, and their virtual desktops can be accessed from any device.

And, using a PowerShell script, your WorkSpaces deployment can be automated, simplifying the administrative chore of distributing new WorkSpaces to your Active Directory users. Through execution of this script, deployment of dozens or thousands of WorkSpaces can be done simply. You can use Amazon Web Services (AWS) provided bundles or custom bundles – templated operating systems – to deploy your WorkSpaces.

In this article, you’ll learn about the required prerequisites to run the PowerShell script, how to execute the script (with guided prompts), how to deploy Amazon WorkSpaces at scale, as well as how to confirm your deployment succeeded. Let’s get started.

The prerequisites

Before you can start automating your WorkSpaces deployment, you must meet the following requirements:

  • An Active Directory deployment that contains a group to deploy Amazon WorkSpaces to, such as an Active Directory on Amazon Elastic Compute Cloud (Amazon EC2) instances, an AWS Directory Service for Microsoft Active Directory, or an on-premises Active Directory environment.
  • A WorkSpaces-registered Directory or AD Connector. Verify the subnets that contain the directory or AD connector have the necessary number of free IP addresses for your WorkSpaces deployment.
  • Run the script on a system joined to the Active Directory Domain that is being queried for user and group information. This can be on an Amazon EC2 instance, a WorkSpaces instance, or a domain-joined local computer.
  • An AWS Identity and Access Management (IAM) user or role with permissions to query the Directory Services, WorkSpaces Bundles, and rights to create WorkSpaces. If you are using an AWS Identity and Access Management (AWS IAM) user, configure the PowerShell session to use your AWS IAM credentials.
  • The Active Directory module for Windows PowerShell installed on the system executing the script.
  • The AWS Tools for PowerShell installed on the system executing the script.

How to automate your WorkSpaces deployment

First things first: Download and save the script to a location on the system configured to meet the prerequisites. Then follow this step-by-step procedure.

1. Execute the script by typing “.FILENAME.PS1” where FILENAME is the name you gave the downloaded file to begin the guided process.

2. When prompted by the script, enter a group name (you can use spaces). The script then queries the group to determine how many users it contains. At this point, you should confirm the quantity of WorkSpaces you are creating.

3. The script will prompt for the path where the log file output is saved during WorkSpaces creation. You can either type a path or accept the default and press the Enter key. The script will create a folder for you if the path does not exist.

4. The script then prompts for a group name and all enabled users in that group will have a WorkSpace provisioned for them.

5. Select the region where the WorkSpaces will be deployed when prompted. Once you’ve selected a region, the script will query your AWS account for directories where users can be deployed. To select the directory that the WorkSpaces will join, type the DirectoryId for the desired directory.

6. The list of available bundles is queried and displayed. Your custom bundles will appear at the end of the list.

7. Select a custom bundle for WorkSpaces deployment. Enter the WorkSpaces BundleId. The script will then create a WorkSpace for each of the users in the Active Directory group. If any WorkSpaces already exist or an error occurs, it is recorded both on the screen and in a log file in the location you specified during script execution.

Note that no modifications are made to previously existing WorkSpaces. You can run the script multiple times without affecting existing operations.

8. Review the log file, which is in comma separated value (.csv) format so it can be exported and then imported into other tools so it can be filtered. When you review the log, it will show:

  • Existing WorkSpaces that were skipped during deployment
  • How many new WorkSpaces were created
  • Any errors during script execution and WorkSpaces deployment

The guided PowerShell script makes it easy to deploy WorkSpaces for all members of an Active Directory group, and the log file offers insight about the success of your automated WorkSpaces deployment. It makes it easy to scale your WorkSpaces to offer your end users a secure, managed, cloud-based virtual desktop experience.

Get the most out of Amazon WorkSpaces with CloudHesive

CloudHesive is a cloud solutions consulting and managed-service provider with expertise in all things Amazon Web Services, including WorkSpaces. We have eight AWS Competencies, more than 50 AWS Certifications, and membership in nine Partner Programs, and the experience and knowledge to help your business realize all the benefits of AWS cloud.

We’ve helped more than 100 companies reduce their operating costs and increase productivity with our focus on security, reliability, availability, and scalability. With over 30 years of experience, we leverage cloud-based technology to its full potential. Contact the CloudHesive team today.