Script to test the Citrix.WEMSDK Powershell module

On January 19th 2020 the first public version of the Citrix WEM Powershell Module (Citrix.WEMSDK) was published to the Powershell Gallery (

The Powershell Gallery page will also show installation instructions, be it using the Install-Module method, or a manual download.

As this is the first release of a whopping 243 commands, the documentation on a per function level is severely lacking at the moment. Don’t worry, it is on my to-do list.

This post is to introduce a powershell script (Citrix.WEMSDK.functiontests.ps1) which can be used to lookup all the functions and see what is needed to effectively use the function.

So you need several things.
First you need to install (and import) the module.
Then you need to download the Citrix.WEMSDK.functiontests.ps1 script from
And of course you need access to a database server with the WEM database. I recommend using this in a test or lab environment first, until you are comfortable enough to use it in a production environment.
Recommended extra requirements: the Active Directory and Applocker powershell modules. The first can be acquired by installing the Active Directory RSAT tools (more info on that:, the second comes natively with Windows 10 and at least Windows Server 2016. The first helps a lot when working with the ADObject functions, the second is a requirement for working with the AppLockerRule functions.

Before using the script to test the functions, you need to modify some stuff in the script to match your environment.
functiontests_01Modify the database settings to match your environment.

functiontests_02These settings are used throughout the function tests. It is not required that these are actual shares. They are just here to test the functions, no actual resolving is done, nor will the shares actually be accessed by the functions.

functiontests_03These settings are also used throughout the function tests. If you do not have the Active Directory module, you will need to enter SID values for each variable (e.g. $SID1 = “S-1-5-21-1644858761-3736240991-3467507639-1299”). If you do use the Active Directory module, as shown in the screenshot, you need to have connectivity to the Active Directory as well.

Those modifications are a onetime deal for this script. You are now good to go test the functions.

All functions are bundled in Powershell Regions. For example, the screenshot below shows all related functions for working with the Configurations (or Sites).

The script ends with a section that outputs arrays of objects that might have been created during the script.

So the recommended way of using this script would be to:

  • Load the script in your favorite Powershell IDE (like Powershell ISE or Visual Studio Code)
  • Select everything from line 1 to line 35
  • Execute the selection (F8)
    Which loads the module and your variables, and sets up the database connection
  • Find the function or functions your wish to test or find out how to use them, and select those lines
  • Execute the selection (F8)
  • Examine the results

That said, if you have all prerequisites in place, and you have correctly edited the variables, nothing is stopping you from running the entire script. You should end up with a fully configured Configuration that you can examine using the WEM Administration Console.

/edit is the official announcement for the Citrix.WEMSDK Powershell Module.


25+ years experience in Microsoft powered environments. Enjoy automating stuff using powershell. In my free time (hah! as if there is any) I used to hunt achievements and gamerscore on anything Xbox Live enabled (Windows Mobile, Windows 8, Windows 10, Xbox 360 and Xbox One). Recently I picked up my Lego addiction again.

Tagged with: , , ,
Posted in Automation, Citrix, Powershell

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog Authors

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 446 other followers

Blog Stats
  • 3,603,287 hits
  • An error has occurred; the feed is probably down. Try again later.
  • An error has occurred; the feed is probably down. Try again later.
%d bloggers like this: