Since Citrix has released Workspace Environment Management 4.2 there is now a complete section about #WEM in the Citrix eDocs. Part of the new official documentation is a section about load balancing advices. But before that, there has already been a superior blog article about that topic by Ryan Revord.
But what is still missing is a complete overview of the necessary NetScaler CLI commands. That way you can import your WEM load balancing configuration in less than a minute! As I try to do everything in NetScaler on the CLI, I documented the steps during my first WEM deployment and wanted to share them with the community.

Prerequisites:

A working NetScaler with a SNIP in the corresponding subnet of your network

Two WEM Broker Server up and running with a third server hosting the SQL database
(When you create the Workspace Environment Management database, select the option Broker Database Connection Uses Windows Security!)

Configure the Service Principal Names (SPNs) for the Citrix Workspace Environment Management Infrastructure Services to use the Broker Service Account name.

Step 2 and 3 are most important! Check twice that you use Windows authentication for SQL and set the SPN to the Windows Account!setspn -U -S Norskale/BrokerService [accountname]

After that we come to the interesting part, we have to load balance 4 TCP ports: 8284, 8286, 8285, 8287

Legend:

WEM Broker #1

xa-wms2016-01.int.corp.de

192.168.24.21

WEM Broker #2

xa-wms2016-02.int.corp.de

192.168.24.22

NetScaler lb vserver VIP

citrix-wem.int.corp.de

192.168.24.30

The following CLI commands have a recurring logic:

Create Service Group for a specific port

Bind WEM Broker #1 to the Service Group with the corresponding port

Bind WEM Broker #2 to the Service Group with the corresponding port

(Bind WEM Broker #x to the Service Group with the corresponding port; in case you would like to have more than two WEM Broker)

Bind the default TCP Monitor to the Service Group

Create the TCP Load Balancing Virtual Server with the corresponding port on the shared IP for all WEM ports

I don’t see any persistence on your LB vServers. From Citrix Docs: “Session persistence is required for the connection between agent and broker, and between consoles and broker. Citrix recommends that you connect all Administration Consoles to one Broker Service, rather than using the VIP.”

You are right. In my original setup I oriented myself at Ryan Tevord where he says: “The Broker is stateless so no need to set persistence either.”
But Citrix says you need Persistence. Should have read more closely. Will fix this tomorrow as soon as possible.

Session persistence is required for the connection between administration consoles and the infrastructure service. (Session persistence between the agent and the infrastructure service is not required.) Citrix recommends that you directly connect each administration console to an infrastructure service server, rather than using the VIP.